void jbInit() throws Exception { setLayout(new AlignLayout(2, 5, 5)); all = new JRadioButton("All"); all.setSelected(true); select = new JRadioButton("User Data"); select.setSelected(false); select.addItemListener( new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { select_itemStateChanged(e); } }); userData = new JTextField(15); // userData.setEnabled(false); ToggleDocument td = new ToggleDocument(); td.addToggleDocumentListener(this); userData.setDocument(td); ButtonGroup bg = new ButtonGroup(); bg.add(all); bg.add(select); add(all); add(new JLabel("")); add(select); add(userData); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); }
/** Add listeners to components. */ private void addListeners() { dirBttn.addActionListener(this); backupBttn.addActionListener(this); runBttn.addActionListener(this); recursiveCheckBox.addItemListener(this); templateCh.addItemListener(this); dirTF.addActionListener(this); staticVersioningRadioButton.addItemListener(this); dynamicVersioningRadioButton.addItemListener(this); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { quit(); } }); }
public void init() { Container contentPane = f.getContentPane(); JPanel p = new JPanel(); // 將兩個元件及 JPanel 加入 JFrame contentPane.add(degree, "North"); contentPane.add(p, "Center"); contentPane.add(go, "South"); // 將 JPanel 設定為使用 GridLayout (4 列、2 行) p.setLayout(new GridLayout(4, 2)); // 將各元件加到 JPanel 中 p.add(deg); p.add(rad); p.add(sinlab); p.add(sintxt); p.add(coslab); p.add(costxt); p.add(tanlab); p.add(tantxt); // 設定選擇角度單位的快捷鍵 deg.setMnemonic(KeyEvent.VK_D); rad.setMnemonic(KeyEvent.VK_R); // 將兩個單選鈕設為一組 ButtonGroup group = new ButtonGroup(); group.add(deg); group.add(rad); deg.setSelected(true); // 將 deg 設為預設選取的項目 go.addActionListener(this); degree.addKeyListener(this); // 單選鈕的選取事件之處理方法 deg.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) convert = 180 / Math.PI; else convert = 1; } }); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(250, 200); f.setVisible(true); }
@Override public void installUI(final JComponent c) { super.installUI(c); radioButton = (JRadioButton) c; // Default settings SwingUtils.setOrientation(c); radioButton.setOpaque(false); // Initial check state checkIcon = radioButton.isSelected() ? CHECK_STATES.size() - 1 : 0; // Updating border and icon updateBorder(); updateIcon(radioButton); // Background fade animation bgTimer = new WebTimer( "WebRadioButtonUI.bgUpdater", 40, new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { if (rollover && bgDarkness < MAX_DARKNESS) { bgDarkness++; c.repaint(); } else if (!rollover && bgDarkness > 0) { bgDarkness--; c.repaint(); } else { bgTimer.stop(); } } }); mouseAdapter = new MouseAdapter() { @Override public void mouseEntered(final MouseEvent e) { rollover = true; if (isAnimated()) { bgTimer.start(); } else { bgDarkness = MAX_DARKNESS; c.repaint(); } } @Override public void mouseExited(final MouseEvent e) { rollover = false; if (isAnimated()) { bgTimer.start(); } else { bgDarkness = 0; c.repaint(); } } }; radioButton.addMouseListener(mouseAdapter); // Selection changes animation checkTimer = new WebTimer( "WebRadioButtonUI.iconUpdater", 40, new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { if (checking && checkIcon < CHECK_STATES.size() - 1) { checkIcon++; c.repaint(); } else if (!checking && checkIcon > 0) { checkIcon--; c.repaint(); } else { checkTimer.stop(); } } }); itemListener = new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { if (animated) { if (radioButton.isSelected()) { checking = true; checkTimer.start(); } else { checking = false; checkTimer.start(); } } else { checkTimer.stop(); checkIcon = radioButton.isSelected() ? CHECK_STATES.size() - 1 : 0; c.repaint(); } } }; radioButton.addItemListener(itemListener); }
public JComponent createComponent() { final JPanel panel = new JPanel(new GridBagLayout()); myClassNameField = new TextFieldWithBrowseButton( new ActionListener() { public void actionPerformed(ActionEvent e) { PsiClass psiClass = DebuggerUtils.getInstance() .chooseClassDialog( DebuggerBundle.message( "title.compound.renderer.configurable.choose.renderer.reference.type"), myProject); if (psiClass != null) { myClassNameField.setText(JVMNameUtil.getNonAnonymousClassName(psiClass)); } } }); myClassNameField .getTextField() .addFocusListener( new FocusAdapter() { public void focusLost(FocusEvent e) { final String qName = myClassNameField.getText(); updateContext(qName); } }); myRbDefaultLabel = new JRadioButton( DebuggerBundle.message("label.compound.renderer.configurable.use.default.renderer")); myRbExpressionLabel = new JRadioButton( DebuggerBundle.message("label.compound.renderer.configurable.use.expression")); final ButtonGroup labelButtonsGroup = new ButtonGroup(); labelButtonsGroup.add(myRbDefaultLabel); labelButtonsGroup.add(myRbExpressionLabel); myRbDefaultChildrenRenderer = new JRadioButton( DebuggerBundle.message("label.compound.renderer.configurable.use.default.renderer")); myRbExpressionChildrenRenderer = new JRadioButton( DebuggerBundle.message("label.compound.renderer.configurable.use.expression")); myRbListChildrenRenderer = new JRadioButton( DebuggerBundle.message("label.compound.renderer.configurable.use.expression.list")); final ButtonGroup childrenButtonGroup = new ButtonGroup(); childrenButtonGroup.add(myRbDefaultChildrenRenderer); childrenButtonGroup.add(myRbExpressionChildrenRenderer); childrenButtonGroup.add(myRbListChildrenRenderer); myLabelEditor = new DebuggerExpressionTextField(myProject, null, "ClassLabelExpression"); myChildrenEditor = new DebuggerExpressionTextField(myProject, null, "ClassChildrenExpression"); myChildrenExpandedEditor = new DebuggerExpressionTextField(myProject, null, "ClassChildrenExpression"); myChildrenListEditor = createChildrenListEditor(); final ItemListener updateListener = new ItemListener() { public void itemStateChanged(ItemEvent e) { updateEnabledState(); } }; myRbExpressionLabel.addItemListener(updateListener); myRbListChildrenRenderer.addItemListener(updateListener); myRbExpressionChildrenRenderer.addItemListener(updateListener); panel.add( new JLabel(DebuggerBundle.message("label.compound.renderer.configurable.apply.to")), new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); panel.add( myClassNameField, new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(4, 0, 0, 0), 0, 0)); panel.add( new JLabel(DebuggerBundle.message("label.compound.renderer.configurable.when.rendering")), new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(20, 0, 0, 0), 0, 0)); panel.add( myRbDefaultLabel, new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0)); panel.add( myRbExpressionLabel, new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0)); panel.add( myLabelEditor, new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 30, 0, 0), 0, 0)); panel.add( new JLabel(DebuggerBundle.message("label.compound.renderer.configurable.when.expanding")), new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(20, 0, 0, 0), 0, 0)); panel.add( myRbDefaultChildrenRenderer, new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0)); panel.add( myRbExpressionChildrenRenderer, new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0)); panel.add( myChildrenEditor, new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 30, 0, 0), 0, 0)); myExpandedLabel = new JLabel(DebuggerBundle.message("label.compound.renderer.configurable.test.can.expand")); panel.add( myExpandedLabel, new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(4, 30, 0, 0), 0, 0)); panel.add( myChildrenExpandedEditor, new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 30, 0, 0), 0, 0)); panel.add( myRbListChildrenRenderer, new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 0, 0), 0, 0)); panel.add( myChildrenListEditor, new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(4, 30, 0, 0), 0, 0)); myMainPanel = new JPanel(new CardLayout()); myMainPanel.add(new JPanel(), EMPTY_PANEL_ID); myMainPanel.add(panel, DATA_PANEL_ID); return myMainPanel; }
public SearchManager2(JabRefFrame frame, SidePaneManager manager) { super(manager, GUIGlobals.getIconUrl("search"), Globals.lang("Search")); this.frame = frame; incSearcher = new IncrementalSearcher(Globals.prefs); // setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.magenta)); searchReq = new JCheckBoxMenuItem( Globals.lang("Search required fields"), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_REQ)); searchOpt = new JCheckBoxMenuItem( Globals.lang("Search optional fields"), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_OPT)); searchGen = new JCheckBoxMenuItem( Globals.lang("Search general fields"), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_GEN)); searchAll = new JCheckBoxMenuItem( Globals.lang("Search all fields"), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_ALL)); regExpSearch = new JCheckBoxMenuItem( Globals.lang("Use regular expressions"), Globals.prefs.getBoolean(JabRefPreferences.REG_EXP_SEARCH)); increment = new JRadioButton(Globals.lang("Incremental"), false); floatSearch = new JRadioButton(Globals.lang("Float"), true); hideSearch = new JRadioButton(Globals.lang("Filter"), true); showResultsInDialog = new JRadioButton(Globals.lang("Show results in dialog"), true); searchAllBases = new JRadioButton( Globals.lang("Global search"), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_ALL_BASES)); ButtonGroup types = new ButtonGroup(); types.add(increment); types.add(floatSearch); types.add(hideSearch); types.add(showResultsInDialog); types.add(searchAllBases); select = new JCheckBoxMenuItem(Globals.lang("Select matches"), false); increment.setToolTipText(Globals.lang("Incremental search")); floatSearch.setToolTipText(Globals.lang("Gray out non-matching entries")); hideSearch.setToolTipText(Globals.lang("Hide non-matching entries")); showResultsInDialog.setToolTipText(Globals.lang("Show search results in a window")); // Add an item listener that makes sure we only listen for key events // when incremental search is turned on. increment.addItemListener(this); floatSearch.addItemListener(this); hideSearch.addItemListener(this); showResultsInDialog.addItemListener(this); // Add the global focus listener, so a menu item can see if this field was focused when // an action was called. searchField.addFocusListener(Globals.focusListener); if (searchAll.isSelected()) { searchReq.setEnabled(false); searchOpt.setEnabled(false); searchGen.setEnabled(false); } searchAll.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent event) { boolean state = !searchAll.isSelected(); searchReq.setEnabled(state); searchOpt.setEnabled(state); searchGen.setEnabled(state); } }); caseSensitive = new JCheckBoxMenuItem( Globals.lang("Case sensitive"), Globals.prefs.getBoolean(JabRefPreferences.CASE_SENSITIVE_SEARCH)); highLightWords = new JCheckBoxMenuItem( Globals.lang("Highlight Words"), Globals.prefs.getBoolean(JabRefPreferences.HIGH_LIGHT_WORDS)); searchAutoComplete = new JCheckBoxMenuItem( Globals.lang("Autocomplete names"), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_AUTO_COMPLETE)); settings.add(select); // 2005.03.29, trying to remove field category searches, to simplify // search usability. // settings.addSeparator(); // settings.add(searchReq); // settings.add(searchOpt); // settings.add(searchGen); // settings.addSeparator(); // settings.add(searchAll); // --------------------------------------------------------------- settings.addSeparator(); settings.add(caseSensitive); settings.add(regExpSearch); settings.addSeparator(); settings.add(highLightWords); settings.addSeparator(); settings.add(searchAutoComplete); searchField.addActionListener(this); searchField.addCaretListener(this); search.addActionListener(this); searchField.addFocusListener( new FocusAdapter() { @Override public void focusGained(FocusEvent e) { if (increment.isSelected()) { searchField.setText(""); } } @Override public void focusLost(FocusEvent e) { incSearch = false; incSearchPos = -1; // Reset incremental // search. This makes the // incremental search reset // once the user moves focus to // somewhere else. if (increment.isSelected()) { // searchField.setText(""); // System.out.println("focuslistener"); } } }); escape.addActionListener(this); escape.setEnabled(false); // enabled after searching openset.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (settings.isVisible()) { // System.out.println("oee"); // settings.setVisible(false); } else { JButton src = (JButton) e.getSource(); settings.show(src, 0, openset.getHeight()); } } }); searchAutoComplete.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { Globals.prefs.putBoolean( JabRefPreferences.SEARCH_AUTO_COMPLETE, searchAutoComplete.isSelected()); if (SearchManager2.this.frame.basePanel() != null) { SearchManager2.this.frame.basePanel().updateSearchManager(); } } }); Insets margin = new Insets(0, 2, 0, 2); // search.setMargin(margin); escape.setMargin(margin); openset.setMargin(margin); JButton help = new JButton(GUIGlobals.getImage("help")); int butSize = help.getIcon().getIconHeight() + 5; Dimension butDim = new Dimension(butSize, butSize); help.setPreferredSize(butDim); help.setMinimumSize(butDim); help.setMargin(margin); help.addActionListener(new HelpAction(Globals.helpDiag, GUIGlobals.searchHelp, "Help")); // Select the last used mode of search: if (Globals.prefs.getBoolean(JabRefPreferences.INCREMENT_S)) { increment.setSelected(true); } else if (Globals.prefs.getBoolean(JabRefPreferences.FLOAT_SEARCH)) { floatSearch.setSelected(true); } else if (Globals.prefs.getBoolean(JabRefPreferences.SHOW_SEARCH_IN_DIALOG)) { showResultsInDialog.setSelected(true); } else if (Globals.prefs.getBoolean(JabRefPreferences.SEARCH_ALL_BASES)) { searchAllBases.setSelected(true); } else { hideSearch.setSelected(true); } JPanel main = new JPanel(); GridBagLayout gbl = new GridBagLayout(); main.setLayout(gbl); GridBagConstraints con = new GridBagConstraints(); con.gridwidth = GridBagConstraints.REMAINDER; con.fill = GridBagConstraints.BOTH; con.weightx = 1; gbl.setConstraints(searchField, con); main.add(searchField); // con.gridwidth = 1; gbl.setConstraints(search, con); main.add(search); con.gridwidth = GridBagConstraints.REMAINDER; gbl.setConstraints(escape, con); main.add(escape); con.insets = new Insets(0, 2, 0, 0); gbl.setConstraints(increment, con); main.add(increment); gbl.setConstraints(floatSearch, con); main.add(floatSearch); gbl.setConstraints(hideSearch, con); main.add(hideSearch); gbl.setConstraints(showResultsInDialog, con); main.add(showResultsInDialog); gbl.setConstraints(searchAllBases, con); main.add(searchAllBases); con.insets = new Insets(0, 0, 0, 0); JPanel pan = new JPanel(); GridBagLayout gb = new GridBagLayout(); gbl.setConstraints(pan, con); pan.setLayout(gb); con.weightx = 1; con.gridwidth = 1; gb.setConstraints(openset, con); pan.add(openset); con.weightx = 0; gb.setConstraints(help, con); pan.add(help); main.add(pan); main.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); setContentContainer(main); searchField.getInputMap().put(Globals.prefs.getKey("Repeat incremental search"), "repeat"); searchField .getActionMap() .put( "repeat", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (increment.isSelected()) { repeatIncremental(); } } }); searchField.getInputMap().put(Globals.prefs.getKey("Clear search"), "escape"); searchField .getActionMap() .put( "escape", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { hideAway(); // SearchManager2.this.actionPerformed(new ActionEvent(escape, 0, "")); } }); setSearchButtonSizes(); updateSearchButtonText(); }
private void initializeComponents() { this.setTitle("Synchro - Kopierassistent"); this.setBounds(0, 0, 550, 600); this.setResizable(true); this.setLayout(null); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.addWindowListener(this); mainPanel = new JPanel(); mainPanel.setBounds(0, 0, this.getWidth() - 20, 25); // fcPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); mainPanel.setLayout(null); btnBackup = new JButton("Backup"); btnBackup.setBounds(this.getWidth() / 2, 0, this.getWidth() / 2 - 20, mainPanel.getHeight()); btnBackup.addActionListener(this); mainPanel.add(btnBackup); this.add(mainPanel); fcPanel = new JPanel(); fcPanel.setBounds(10, 40, this.getWidth(), 260); // fcPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); fcPanel.setLayout(null); quellLabel = new JLabel("Bitte Quellverzeichnis auswählen"); quellLabel.setBounds(10, 5, 320, 20); fcPanel.add(quellLabel); quellListModel = new DefaultListModel<>(); quellJList = new JList<ListItem>(quellListModel); quellJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); quellJList.setLayoutOrientation(JList.VERTICAL); quellJList.addListSelectionListener(this); listBoxScroller = new JScrollPane(quellJList); listBoxScroller.setBounds(0, 30, 315, 100); fcPanel.add(listBoxScroller); btnQAuswahl = new JButton("Quellverz. hinzufügen"); btnQAuswahl.setBounds(320, 30, 200, 25); btnQAuswahl.addActionListener(this); fcPanel.add(btnQAuswahl); btnQEntfernen = new JButton("Quellverz. entfernen"); btnQEntfernen.setBounds(320, 60, 200, 25); btnQEntfernen.addActionListener(this); fcPanel.add(btnQEntfernen); zielLabel = new JLabel("Bitte Zielverzeichnis auswählen"); zielLabel.setBounds(10, 135, 320, 20); fcPanel.add(zielLabel); zielListModel = new DefaultListModel<>(); zielJList = new JList<ListItem>(zielListModel); zielJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); zielJList.setLayoutOrientation(JList.VERTICAL); zielJList.addListSelectionListener(this); listBoxScroller2 = new JScrollPane(zielJList); listBoxScroller2.setBounds(0, 160, 315, 100); fcPanel.add(listBoxScroller2); btnZAuswahl = new JButton("Zielverz. hinzufügen"); btnZAuswahl.setBounds(320, 160, 200, 25); btnZAuswahl.addActionListener(this); fcPanel.add(btnZAuswahl); btnZEntfernen = new JButton("Zielverz. entfernen"); btnZEntfernen.setBounds(320, 190, 200, 25); btnZEntfernen.addActionListener(this); fcPanel.add(btnZEntfernen); this.add(fcPanel); ButtonGroup bGrp = new ButtonGroup(); optionPanel = new JPanel(); optionPanel.setBounds(10, 300 + 10, this.getWidth() - 40, 90); optionPanel.setPreferredSize(new Dimension(this.getWidth() - 40, 90)); // optionPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); optionPanel.setLayout(new GridLayout(3, 1)); nUebSchr = new JRadioButton("Keine Dateien überschreiben"); nUebSchr.addItemListener(this); bGrp.add(nUebSchr); optionPanel.add(nUebSchr); ueSchr = new JRadioButton("Neuere Dateien überschreiben"); ueSchr.addItemListener(this); bGrp.add(ueSchr); optionPanel.add(ueSchr); aUeSchr = new JRadioButton("Alle Dateien überschreiben"); aUeSchr.addItemListener(this); bGrp.add(aUeSchr); optionPanel.add(aUeSchr); this.add(optionPanel); syncPanel = new JPanel(); syncPanel.setBounds( 10, optionPanel.getY() + optionPanel.getHeight() + 10, this.getWidth() - 30, 25); // syncPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); syncPanel.setLayout(new BorderLayout()); btnSync = new JButton("Sync it!"); btnSync.setBounds(0, 0, 150, (syncPanel.getHeight() / 3)); btnSync.addActionListener(this); btnSync.setPreferredSize(new Dimension(150, (syncPanel.getHeight() / 3))); btnSync.setMaximumSize(new Dimension(150, (syncPanel.getHeight() / 3))); syncPanel.add(btnSync, BorderLayout.LINE_START); btnAbbruch = new JButton("Abbrechen"); btnAbbruch.setBounds(0, 0, 150, (syncPanel.getHeight() / 3)); btnAbbruch.addActionListener(this); btnAbbruch.setPreferredSize(new Dimension(150, (syncPanel.getHeight() / 3))); btnAbbruch.setMaximumSize(new Dimension(150, (syncPanel.getHeight() / 3))); btnAbbruch.setVisible(false); syncPanel.add(btnAbbruch, BorderLayout.LINE_END); progressBar = new JProgressBar(JProgressBar.HORIZONTAL); progressBar.setBorderPainted(true); progressBar.setPreferredSize(new Dimension(300, (syncPanel.getHeight() / 3))); progressBar.setForeground(Color.RED); progressBar.setStringPainted(true); progressBar.setVisible(true); syncPanel.add(progressBar, BorderLayout.CENTER); this.add(syncPanel); logPanel = new JPanel(); logPanel.setBounds( 10, syncPanel.getY() + syncPanel.getHeight() + 10, this.getWidth() - 30, 105); logPanel.setLayout(new BorderLayout()); textArea = new JTextArea(); textArea.setMargin(new Insets(3, 3, 3, 3)); textArea.setBackground(Color.black); textArea.setForeground(Color.LIGHT_GRAY); textArea.setAutoscrolls(true); textArea.setFocusable(false); textAreaScroller = new JScrollPane(textArea); DefaultCaret caret = (DefaultCaret) textArea.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); textAreaScroller.setBounds(0, 0, syncPanel.getWidth(), 50); logPanel.add(textAreaScroller, BorderLayout.CENTER); this.add(logPanel, BorderLayout.SOUTH); }