Java Code Examples for javax.swing.JTextArea.setFont()

The following are Jave code examples for showing how to use setFont() of the javax.swing.JTextArea class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: VASSAL-src   File: ImagePicker.java   Source Code and License Vote up 21 votes
public ImagePicker() {
  noImage = new JTextArea(1,10);
  noImage.setFont(FONT);
  noImage.setText("Double-click here to add new image");
  noImage.addMouseListener(this);
  noImage.setEditable(false);
  noImage.setLineWrap(true);
  noImage.setWrapStyleWord(true);
  noImage.setMinimumSize(new Dimension(15, 32));
  icon = new OpIcon();
  imageView = new JLabel(icon);
  imageView.addMouseListener(this);

  imageViewer = new JPanel(new BorderLayout());
  imageScroller = new ScrollPane(
    imageView,
    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  imageViewer.add(imageScroller, BorderLayout.CENTER);

  select = new JComboBox(ArrayUtils.prepend(GameModule.getGameModule().getDataArchive().getImageNames(), NO_IMAGE));
  select.addItemListener(this);
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  add(noImage);
  add(select);
}
 
Example 2
Project: ThingML-Tradfri   File: BulbPanel.java   Source Code and License Vote up 7 votes
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    
    try {
        //JOptionPane pane = new JOptionPane();
        //pane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
        JDialog dialog = new JDialog((Frame)null, "Result of COAP GET for bulb " + bulb.getName(), false);
        JTextArea msg = new JTextArea(bulb.getJsonObject().toString(4) + "\n");
        msg.setFont(new Font("monospaced", Font.PLAIN, 10));
        msg.setLineWrap(true);
        msg.setWrapStyleWord(true);
        JScrollPane scrollPane = new JScrollPane(msg);
        
        dialog.getContentPane().add(scrollPane);
        dialog.setSize(350, 350);
        //dialog.pack();
        dialog.setVisible(true);
        
        
    } catch (JSONException ex) {
        Logger.getLogger(BulbPanel.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
Example 3
Project: SE2Project   File: KundenDetailAnzeigerUI.java   Source Code and License Vote up 7 votes
/**
 * Erzeugt das Panel in dem die Kundendetails angezeigt werden.
 */
private void erzeugeKundenAnzeiger()
{
    JScrollPane medienAnzeigerScrollPane = new JScrollPane();
    medienAnzeigerScrollPane.setPreferredSize(new Dimension(-1, 160));
    medienAnzeigerScrollPane.setSize(-1, -1);
    medienAnzeigerScrollPane.setBorder(BorderFactory.createTitledBorder(
            null, "Ausgewählter Kunde", TitledBorder.LEADING,
            TitledBorder.DEFAULT_POSITION, UIConstants.HEADER_FONT));
    medienAnzeigerScrollPane.setBackground(UIConstants.BACKGROUND_COLOR);
    medienAnzeigerScrollPane.getVerticalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);
    medienAnzeigerScrollPane.getHorizontalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);

    _kundenAnzeigerTextArea = new JTextArea();
    _kundenAnzeigerTextArea.setBackground(UIConstants.BACKGROUND_COLOR);
    medienAnzeigerScrollPane.setViewportView(_kundenAnzeigerTextArea);
    _kundenAnzeigerTextArea.setEditable(false);
    _kundenAnzeigerTextArea.setFont(UIConstants.TEXT_FONT);

    _hauptPanel.add(medienAnzeigerScrollPane, BorderLayout.CENTER);
}
 
Example 4
Project: SE2Project   File: MedienDetailAnzeigerUI.java   Source Code and License Vote up 7 votes
/**
 * Erzeugt das Panel in dem die Mediendetails angezeigt werden.
 */
private void erzeugeMedienAnzeiger()
{
    JScrollPane medienAnzeigerScrollPane = new JScrollPane();
    medienAnzeigerScrollPane.setPreferredSize(new Dimension(-1, 160));
    medienAnzeigerScrollPane.setSize(-1, -1);
    medienAnzeigerScrollPane.setBorder(BorderFactory.createTitledBorder(
            null, "Ausgewählte Medien", TitledBorder.LEADING,
            TitledBorder.DEFAULT_POSITION, UIConstants.HEADER_FONT));
    medienAnzeigerScrollPane.setBackground(UIConstants.BACKGROUND_COLOR);
    medienAnzeigerScrollPane.getVerticalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);
    medienAnzeigerScrollPane.getHorizontalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);

    _medienAnzeigerTextArea = new JTextArea();
    _medienAnzeigerTextArea.setBackground(UIConstants.BACKGROUND_COLOR);
    medienAnzeigerScrollPane.setViewportView(_medienAnzeigerTextArea);
    _medienAnzeigerTextArea.setEditable(false);
    _medienAnzeigerTextArea.setFont(UIConstants.TEXT_FONT);

    _hauptPanel.add(medienAnzeigerScrollPane, BorderLayout.CENTER);
}
 
Example 5
Project: EditCalculateAndChart   File: HelpFrame.java   Source Code and License Vote up 6 votes
public void createAndShow() throws Exception{
    Preferences Config = TEdit.getConfig();
    JTextArea area = new JTextArea(10,40);
    area.setEditable(false);
              String Font_Name =  Config.get("FONT_NAME","Monospaced");
              int Font_Size = Config.getInt("FONT_SIZE",12);
              int Font_Style = Config.getInt("FONT_STYLE",Font.PLAIN);
              area.setFont(new Font(Font_Name,Font_Style,Font_Size));
              	JScrollPane scroll = new JScrollPane(area,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
		this.add(scroll,BorderLayout.CENTER);
                if(txt == null){
                    BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("org/ioblako/edit/resources/Help.txt"), "UTF-8"));
                     for (int c = br.read(); c != -1; c = br.read()) sb.append((char)c);
                     txt=sb.toString();
                }
                
                area.setText(txt);
                this.setTitle("Help");
                this.pack();
                this.setVisible(true);
               
}
 
Example 6
Project: EspressoViews   File: WarningMessage.java   Source Code and License Vote up 6 votes
public WarningMessage(String ErrMessage) {
	setBounds(100, 100, 650, 500);
	this.getContentPane().setLayout(new BorderLayout());
	{
		JPanel buttonPane = new JPanel();
		buttonPane.setBackground(new Color(144, 238, 144));
		buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
		getContentPane().add(buttonPane, BorderLayout.SOUTH);
		{
			JButton cancelButton = new JButton("OK");
			cancelButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
					dispose();
				}
			});
			cancelButton.setFont(new Font("Times New Roman", Font.BOLD, 12));
			cancelButton.setHorizontalAlignment(SwingConstants.LEFT);
			buttonPane.add(cancelButton);
		}
	}
	{
		JLabel label = new JLabel("Warning!");
		label.setBackground(new Color(144, 238, 144));
		label.setHorizontalAlignment(SwingConstants.CENTER);
		label.setForeground(new Color(100, 0, 0));
		label.setFont(new Font("Times New Roman", Font.BOLD, 24));
		getContentPane().add(label, BorderLayout.NORTH);
	}
	{
		JScrollPane scrollPane = new JScrollPane();
		getContentPane().add(scrollPane, BorderLayout.CENTER);
		{
			JTextArea txtErrMessage = new JTextArea();
			txtErrMessage.setText(ErrMessage);
			txtErrMessage.setFont(new Font("Monospaced", Font.PLAIN, 13));
			txtErrMessage.setBackground(new Color(144, 238, 144));
			scrollPane.setViewportView(txtErrMessage);
			txtErrMessage.setCaretPosition(0);
			txtErrMessage.setEditable(false);
		}
	}
}
 
Example 7
Project: openjdk-jdk10   File: EditPad.java   Source Code and License Vote up 6 votes
@Override
public void run() {
    JFrame jframe = new JFrame(windowLabel == null
            ? getResourceString("editpad.name")
            : windowLabel);
    Runnable closer = () -> {
        jframe.setVisible(false);
        jframe.dispose();
        closeMark.run();
    };
    jframe.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            closer.run();
        }
    });
    jframe.setLocationRelativeTo(null);
    jframe.setLayout(new BorderLayout());
    JTextArea textArea = new JTextArea(initialText);
    textArea.setFont(new Font("monospaced", Font.PLAIN, 13));
    jframe.add(new JScrollPane(textArea), BorderLayout.CENTER);
    jframe.add(buttons(closer, textArea), BorderLayout.SOUTH);

    jframe.setSize(800, 600);
    jframe.setVisible(true);
}
 
Example 8
Project: Install_Builder_Universal   File: GNULicenseWindow.java   Source Code and License Vote up 6 votes
private void initialize() {
	txtArea = new JTextArea();
	txtArea.setFont(new Font(Font.SANS_SERIF, 0, 12));
	txtArea.setEditable(false);
	JScrollPane sp = new JScrollPane(txtArea);
	sp.setBounds(5, 5, 600, 410);
	frame.getContentPane().add(sp);
	
	btnOk = new JButton("OK");
	btnOk.setFont(new Font(Font.SANS_SERIF, 0, 12));
	btnOk.setBounds(510, 420, 95, 20);
	btnOk.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			frame.dispose();
		}
	});
	frame.getContentPane().add(btnOk);
	
	txtArea.append(new Utils().getLicenseFile());
	txtArea.setCaretPosition(0);
}
 
Example 9
Project: Equella   File: ExceptionDialog.java   Source Code and License Vote up 6 votes
private JComponent createNiceMessages()
{
	JLabel heading = new JLabel("<html><font size=+1>" + title + "</font></html>");

	JTextArea body = new JTextArea(message);
	body.setHighlighter(null);
	body.setEditable(false);
	body.setFocusable(false);
	body.setOpaque(false);
	body.setBorder(null);
	body.setLineWrap(true);
	body.setWrapStyleWord(true);
	body.setFont(heading.getFont());

	final int[] rows = new int[]{heading.getPreferredSize().height, TableLayout.FILL};
	final int[] columns = new int[]{TableLayout.FILL};

	TableLayout layout = new TableLayout(rows, columns, 5, 5);
	JPanel all = new JPanel(layout);
	all.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	all.add(heading, new Rectangle(0, 0, 1, 1));
	all.add(body, new Rectangle(0, 1, 1, 1));

	return all;
}
 
Example 10
Project: sstore-soft   File: PlanTreeCatalogNode.java   Source Code and License Vote up 5 votes
private void init() {
        // GraphVisualization
        RenderContext<AbstractPlanNode, PlanNodeGraph.Edge> context = this.visualizationPanel.getRenderContext();
        context.setEdgeShapeTransformer(new EdgeShape.Line<AbstractPlanNode, PlanNodeGraph.Edge>());
        context.setVertexFontTransformer(new GraphVisualizationPanel.VertexFontTransformer<AbstractPlanNode>(true));

//        PlanFragmentBoundaries boundaryPainter = new PlanFragmentBoundaries();
//        this.visualizationPanel.addPostRenderPaintable(boundaryPainter);
        
        // Full Plan Tab
        JPanel textInfoPanel = new JPanel();
        textInfoPanel.setLayout(new BorderLayout());
        JTextArea textInfoTextArea = new JTextArea();
        textInfoTextArea.setEditable(false);
        textInfoTextArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
        textInfoTextArea.setText(PlanNodeUtil.debug(this.root));
        textInfoPanel.add(new JScrollPane(textInfoTextArea), BorderLayout.CENTER);

        // Node Field Tab
        this.nodeField = new JTextArea();
        this.nodeField.setEditable(false);
        this.nodeField.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
        this.nodeField.setText("");
        JPanel textInfoPanel2 = new JPanel(new BorderLayout());
        textInfoPanel2.add(new JScrollPane(this.nodeField), BorderLayout.CENTER);
        
        this.tabbedPane = new JTabbedPane();
        this.tabbedPane.add("Full Plan", textInfoPanel);
        this.tabbedPane.add("Selected Node", textInfoPanel2);
        
        JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, visualizationPanel, this.tabbedPane);
        splitPane.setDividerLocation(AbstractViewer.DEFAULT_WINDOW_HEIGHT - 500);
        this.mainPanel.add(splitPane, BorderLayout.CENTER);
    }
 
Example 11
Project: org.alloytools.alloy   File: VizGUI.java   Source Code and License Vote up 5 votes
/** Helper method returns a JTextArea containing the given text. */
private JComponent getTextComponent(String text) {
	final JTextArea ta = OurUtil.textarea(text, 10, 10, false, true);
	final JScrollPane ans = new JScrollPane(ta, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
			JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) {
		private static final long serialVersionUID = 0;

		@Override
		public void setFont(Font font) {
			ta.setFont(font);
		}
	};
	ans.setBorder(new OurBorder(true, false, true, false));
	return ans;
}
 
Example 12
Project: JavaGraph   File: ExplorationStatsDialog.java   Source Code and License Vote up 5 votes
private JScrollPane getInfoPane() {
    // Create a text pane
    JTextArea infoPane = new JTextArea();
    infoPane.setEditable(false);
    infoPane.setBackground(Color.WHITE);
    // Text font
    Font font = new Font("Lucida Sans Typewriter", Font.PLAIN, 12);
    infoPane.setFont(font);
    infoPane.setTabSize(4);
    // Get the message and the stack trace from the exception and put them
    // in text pane.

    String info = this.simulator.getModel()
        .getExplorationStats()
        .getReport();
    infoPane.setText(info);

    // Pane to create the scroll bars.
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setPreferredSize(new Dimension(700, 500));
    scrollPane.setBorder(BorderFactory.createTitledBorder(null,
        STATS_HEADER_TEXT,
        TitledBorder.DEFAULT_JUSTIFICATION,
        TitledBorder.DEFAULT_POSITION));
    scrollPane.setViewportView(infoPane);

    return scrollPane;
}
 
Example 13
Project: JavaGraph   File: MultiLinedEditor.java   Source Code and License Vote up 5 votes
/**
 * Initialises the editor component with the edit string of the user
 * object of <tt>value</tt> (which is required to be a {@link JCell}).
 */
@Override
public Component getGraphCellEditorComponent(org.jgraph.JGraph graph, Object value,
        boolean isSelected) {
    AspectJCell jCell = (AspectJCell) value;
    // fill the set of labels for autocompletion
    this.labels.clear();
    this.labels.addAll(prefixes);
    AspectJModel jmodel = (AspectJModel) graph.getModel();
    TypeGraph type = jmodel.getResourceModel().getGrammar().getTypeGraph();
    for (TypeLabel label : type.getLabels()) {
        this.labels.add(label.text());
    }
    JTextArea result = getEditorComponent();
    // scale with the jGraph
    Font font = Options.getLabelFont().deriveFont(jCell.getVisuals().getFont());
    font = (font != null) ? font : graph.getFont();
    if (graph.getScale() != 1) {
        double scale = graph.getScale();
        Dimension size = result.getSize();
        size.height *= scale;
        size.width *= scale;
        result.setSize(size);
        font = font.deriveFont((float) (font.getSize() * scale));
    }
    result.setFont(font);
    String editString = ((AspectJCell) value).getUserObject().toEditString();
    result.setText(editString);
    result.selectAll();
    return result;
}
 
Example 14
Project: OpenJSharp   File: XTextAreaPeer.java   Source Code and License Vote up 4 votes
@Override
public void installUI(JComponent c) {
    super.installUI(c);

    jta = (JTextArea) c;

    JTextArea editor = jta;

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();
    Font f = editor.getFont();
    if ((f == null) || (f instanceof UIResource)) {
        editor.setFont(uidefaults.getFont(prefix + ".font"));
    }

    Color bg = editor.getBackground();
    if ((bg == null) || (bg instanceof UIResource)) {
        editor.setBackground(uidefaults.getColor(prefix + ".background"));
    }

    Color fg = editor.getForeground();
    if ((fg == null) || (fg instanceof UIResource)) {
        editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
    }

    Color color = editor.getCaretColor();
    if ((color == null) || (color instanceof UIResource)) {
        editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
    }

    Color s = editor.getSelectionColor();
    if ((s == null) || (s instanceof UIResource)) {
        editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
    }

    Color sfg = editor.getSelectedTextColor();
    if ((sfg == null) || (sfg instanceof UIResource)) {
        editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
    }

    Color dfg = editor.getDisabledTextColor();
    if ((dfg == null) || (dfg instanceof UIResource)) {
        editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
    }

    Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight);
    editor.setBorder(new BorderUIResource.CompoundBorderUIResource(
        b,new EmptyBorder(2, 2, 2, 2)));

    Insets margin = editor.getMargin();
    if (margin == null || margin instanceof UIResource) {
        editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
    }
}
 
Example 15
Project: voicemenu   File: Style.java   Source Code and License Vote up 4 votes
private static void setScreen(JTextArea myScreen) {
  myScreen.setFont(new Font("Arial", Font.PLAIN, 16));
  myScreen.setMargin(new Insets(5, 5, 5, 5));
}
 
Example 16
Project: se459_team9_trivia_game   File: ProhibitedWordList.java   Source Code and License Vote up 4 votes
/**
 * Create the dialog.
 */
public ProhibitedWordList() {
	setBounds(100, 100, 450, 768);
	getContentPane().setLayout(new BorderLayout());
	contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
	getContentPane().add(contentPanel, BorderLayout.CENTER);
	contentPanel.setLayout(null);
	
	JLabel prohibitedWords = new JLabel("Prohibited Words");
	prohibitedWords.setFont(new Font("Lucida Grande", Font.PLAIN, 20));
	prohibitedWords.setHorizontalAlignment(SwingConstants.CENTER);
	prohibitedWords.setBounds(95, 6, 221, 25);
	contentPanel.add(prohibitedWords);
	
	JTextArea wordList = new JTextArea();
	wordList.setFont(new Font("Lucida Grande", Font.PLAIN, 20));
	wordList.setBounds(29, 43, 403, 687);
	
	wordList.setText("          1.. Scrum \n" + 
			"          2. Daily scrum \n" + 
			"          3. Scrum of scrums \n" + 
			"          4. Scrum master \n" + 
			"          5. Product owner \n" + 
			"          6. Team member \n" + 
			"          7. Story point \n" + 
			"          8. Value \n" + 
			"          9. Estimation \n" + 
			"          10. Sprint Retrospective \n" + 
			"          11. Sprint Review \n" + 
			"          12. Sprint Planning \n" + 
			"          13. Sprint \n" + 
			"          14. I teration \n" + 
			"          15. Epic \n" + 
			"          16. Spike \n" + 
			"          17. Sprint Backlog \n" + 
			"          18. Product Backlog \n" + 
			"          19. Backlog Grooming \n" + 
			"          20. Effort \n" + 
			"          21. Ideal work day \n" + 
			"          22. Simple story \n" + 
			"          23. Compound story \n" + 
			"          24. Unknowns \n" + 
			"          25. Knowns \n" + 
			"          26. Kanban \n" + 
			"          27. eXtreme Programming");
	contentPanel.add(wordList);
	{
		JPanel buttonPane = new JPanel();
		buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
		getContentPane().add(buttonPane, BorderLayout.SOUTH);
	}
}
 
Example 17
Project: BrainControl   File: MarioError.java   Source Code and License Vote up 4 votes
public MarioError(String errorMessage){
	super("ERROR");
	//applicable for multi monitor workstations
	GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
	screenWidth = gd.getDisplayMode().getWidth();
	screenHight = gd.getDisplayMode().getHeight(); 

	this.setLocation((int)((screenWidth - frameWidth)*0.5), (int)(screenHight*0.25));
	this.setSize(frameWidth , (int)(screenHight*0.5)); 
	this.getContentPane().setLayout(new GridBagLayout());
	this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	
	titleLabel = new JLabel();
	titleLabel.setText("Unfortunately an Error occured");
	titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
	titleLabel.setFont(new Font(titleLabel.getFont().getFontName(), Font.BOLD, 32));
	titleLabel.setForeground(Color.RED);
	titleLabel.setVisible(true);
	LayoutHelper.putGrid(this, titleLabel, 0, 0, 2,1, 1.0, 1.0);
	
	
	errorText = new JTextArea();
	errorText.setText(errorMessage);
	errorText.setWrapStyleWord(true);
    errorText.setLineWrap(true);
    errorText.setEditable(false);
	errorText.setFont(new Font(errorText.getFont().getFontName(), Font.BOLD, 20));
	errorText.setVisible(true);
	

	errorScrollPane = new JScrollPane(errorText);
	errorText.setCaretPosition(0);
	LayoutHelper.putGrid(this, errorScrollPane, 0, 1, 2,1, 1.0, 1.0);
	
	helpButton = new JButton("HELP");
	helpButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			if (Desktop.isDesktopSupported()) {
			    try {
			        File myFile = new File("D:/Data/Desktop/Mario SoSe15 Einf�hrung/MarioHelp.pdf");
			        Desktop.getDesktop().open(myFile);
			    } catch (IOException ex) {
			        new MarioError("Could not find help file");
			    }
			}
		}
	});
	LayoutHelper.putGrid(this, helpButton, 0, 2, 2,1, 1.0, 0.2);	
	this.setVisible(true);
}
 
Example 18
Project: parabuild-ci   File: DatabaseManagerSwing.java   Source Code and License Vote up 4 votes
private void initGUI() {

        JPanel pCommand = new JPanel();

        pResult = new JPanel();
        nsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, pCommand,
                                     pResult);

        pCommand.setLayout(new BorderLayout());
        pResult.setLayout(new BorderLayout());

        Font fFont = new Font("Dialog", Font.PLAIN, 12);

        txtCommand = new JTextArea(5, 40);

        txtCommand.setMargin(new Insets(5, 5, 5, 5));
        txtCommand.addKeyListener(this);

        txtCommandScroll = new JScrollPane(txtCommand);
        txtResult        = new JTextArea(20, 40);

        txtResult.setMargin(new Insets(5, 5, 5, 5));

        txtResultScroll = new JScrollPane(txtResult);

        txtCommand.setFont(fFont);
        txtResult.setFont(new Font("Courier", Font.PLAIN, 12));
/*
// button replaced by toolbar
        butExecute = new JButton("Execute");

        butExecute.addActionListener(this);
        pCommand.add(butExecute, BorderLayout.EAST);
*/
        pCommand.add(txtCommandScroll, BorderLayout.CENTER);

        gResult = new GridSwing();

        TableSorter sorter = new TableSorter(gResult);

        tableModel   = sorter;
        gResultTable = new JTable(sorter);

        sorter.setTableHeader(gResultTable.getTableHeader());

        gScrollPane = new JScrollPane(gResultTable);

        gResultTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        gResult.setJTable(gResultTable);

        //getContentPane().setLayout(new BorderLayout());
        pResult.add(gScrollPane, BorderLayout.CENTER);

        // Set up the tree
        rootNode    = new DefaultMutableTreeNode("Connection");
        treeModel   = new DefaultTreeModel(rootNode);
        tTree       = new JTree(treeModel);
        tScrollPane = new JScrollPane(tTree);

        tScrollPane.setPreferredSize(new Dimension(120, 400));
        tScrollPane.setMinimumSize(new Dimension(70, 100));
        txtCommandScroll.setPreferredSize(new Dimension(360, 100));
        txtCommandScroll.setMinimumSize(new Dimension(180, 100));
        gScrollPane.setPreferredSize(new Dimension(460, 300));

        ewSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                                     tScrollPane, nsSplitPane);

        fMain.getContentPane().add(ewSplitPane, BorderLayout.CENTER);
        doLayout();
        fMain.pack();
    }
 
Example 19
Project: jdk8u-jdk   File: XTextAreaPeer.java   Source Code and License Vote up 4 votes
@Override
public void installUI(JComponent c) {
    super.installUI(c);

    jta = (JTextArea) c;

    JTextArea editor = jta;

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();
    Font f = editor.getFont();
    if ((f == null) || (f instanceof UIResource)) {
        editor.setFont(uidefaults.getFont(prefix + ".font"));
    }

    Color bg = editor.getBackground();
    if ((bg == null) || (bg instanceof UIResource)) {
        editor.setBackground(uidefaults.getColor(prefix + ".background"));
    }

    Color fg = editor.getForeground();
    if ((fg == null) || (fg instanceof UIResource)) {
        editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
    }

    Color color = editor.getCaretColor();
    if ((color == null) || (color instanceof UIResource)) {
        editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
    }

    Color s = editor.getSelectionColor();
    if ((s == null) || (s instanceof UIResource)) {
        editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
    }

    Color sfg = editor.getSelectedTextColor();
    if ((sfg == null) || (sfg instanceof UIResource)) {
        editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
    }

    Color dfg = editor.getDisabledTextColor();
    if ((dfg == null) || (dfg instanceof UIResource)) {
        editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
    }

    Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight);
    editor.setBorder(new BorderUIResource.CompoundBorderUIResource(
        b,new EmptyBorder(2, 2, 2, 2)));

    Insets margin = editor.getMargin();
    if (margin == null || margin instanceof UIResource) {
        editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
    }
}
 
Example 20
Project: PointOfSale   File: Cart.java   Source Code and License Vote up 4 votes
public Cart() {
	DecimalFormat money = new DecimalFormat("0.00");
	
	
	System.out.println("CREATING CART");
	resetCartFields();

	//add(shoppingList);
	
	scroll = generateScrollPane();

	sub = new JTextArea();
	tot = new JTextArea();
	fTot = new JTextArea();
	
	updatePriceFields();

	Font font = new Font(sub.getFont().getFontName(), Font.PLAIN, 24);
	sub.setFont(font);
	tot.setFont(font);
	fTot.setFont(font);

	sub.setBackground(null);
	tot.setBackground(null);
	fTot.setBackground(null);
	
	sub.setEditable(false);
	tot.setEditable(false);
	fTot.setEditable(false);
	
	setLayout(new GridLayout(4,1));
	
	add(scroll);
	add(sub);
	add(tot);
	add(fTot);
	
	
	//pricing.add(subP);
	//pricing.add(totP);
	//pricing.add(fTotP);
	//add(pricing);
}