List of usage examples for javax.swing JLabel setForeground
@BeanProperty(preferred = true, visualUpdate = true, description = "The foreground color of the component.") public void setForeground(Color fg)
From source file:org.prom5.analysis.decisionmining.DecisionAttribute.java
/** * Builds a panel containing a checkbox to include or exclude * this attribute, and a combobox in order to chose an attribute type. *//*from w w w . ja v a 2 s . co m*/ private void buildAttributePanel() { myPanel = new JPanel(); myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.LINE_AXIS)); JLabel myNameLabel = new JLabel("Attribute name: "); myNameLabel.setForeground(new Color(100, 100, 100)); myPanel.add(myNameLabel); myNameCheckBox = new JCheckBox(getName()); // per default select everything myNameCheckBox.setSelected(true); // register check/uncheck action myNameCheckBox.addActionListener(new ActionListener() { // specify action when the attribute selection scope is changed public void actionPerformed(ActionEvent e) { JCheckBox cb = (JCheckBox) e.getSource(); HLAttribute simAtt = getSimulationAttribute(); if (cb.isSelected() == true) { myTypeGuiRepresenation.enable(); // add attribute to simulation model // and to related activities createSimulationAttribute(); } else { myTypeGuiRepresenation.disable(); // remove attribute from simulation model // (automatically removes attribute from contained activities) hlProcess.removeAttribute(simAtt.getID()); } } }); myPanel.add(myNameCheckBox); myPanel.add(Box.createHorizontalGlue()); createAttributeTypeGui(); // ArrayList<DecisionAttributeType> attributeTypes = new ArrayList<DecisionAttributeType>(); // // per default set "nominal" // attributeTypes.add(DecisionAttributeType.NOMINAL); // attributeTypes.add(DecisionAttributeType.NUMERIC); // myTypeGuiRepresenation = new GUIPropertyListWithoutGlue("Attribute type:", // "Please determine the type of the attribute", attributeTypes, this); myPanel.add(myTypeGuiRepresenation.getPropertyPanel()); }
From source file:org.rdv.datapanel.AbstractDataPanel.java
JComponent getDescriptionComponent() { JLabel descriptionLabel = new JLabel(description); descriptionLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); descriptionLabel.setFont(descriptionLabel.getFont().deriveFont(Font.BOLD)); descriptionLabel.setForeground(Color.white); return descriptionLabel; }
From source file:org.squidy.nodes.ReacTIVision.java
public static void showErrorPopUp(String errorMessage) { //get screen size Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); //create pop up final JFrame frame = new JFrame(); frame.setResizable(false);/*from w w w . j a va2 s. c o m*/ frame.setAlwaysOnTop(true); frame.setUndecorated(true); JLabel text = new JLabel(" " + errorMessage + " "); frame.getContentPane().setBackground(Color.RED); text.setForeground(Color.WHITE); frame.add(text); frame.pack(); frame.setLocation((dim.width - frame.getWidth()) / 2, (dim.height - frame.getHeight()) / 2); frame.setVisible(true); frame.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent arg0) { frame.dispose(); } }); }
From source file:org.tinymediamanager.ui.settings.ExternalServicesSettingsPanel.java
public ExternalServicesSettingsPanel() { setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); {/*from w w w . ja v a 2 s.c om*/ JPanel panelTrakttv = new JPanel(); panelTrakttv.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.trakttv"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panelTrakttv, "2, 2, fill, fill"); panelTrakttv.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(25dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); final JLabel lblTraktStatus = new JLabel(""); //$NON-NLS-1$ panelTrakttv.add(lblTraktStatus, "2, 2, 5, 1"); JButton btnGetTraktPin = new JButton(BUNDLE.getString("Settings.trakt.getpin")); //$NON-NLS-1$ panelTrakttv.add(btnGetTraktPin, "2, 4"); JButton btnTestTraktConnection = new JButton(BUNDLE.getString("Settings.trakt.testconnection")); //$NON-NLS-1$ panelTrakttv.add(btnTestTraktConnection, "4, 4"); if (!Globals.isDonator()) { btnGetTraktPin.setEnabled(false); btnTestTraktConnection.setEnabled(false); String msg = "<html><body>" + BUNDLE.getString("tmm.donatorfunction.hint") + "</body></html>"; //$NON-NLS-1$ JLabel lblTraktDonator = new JLabel(msg); lblTraktDonator.setForeground(Color.RED); panelTrakttv.add(lblTraktDonator, "2, 8, 3, 1, default, default"); } else { if (StringUtils.isNoneBlank(Globals.settings.getTraktAccessToken(), Globals.settings.getTraktRefreshToken())) { lblTraktStatus.setText(BUNDLE.getString("Settings.trakt.status.good")); //$NON-NLS-1$ } else { lblTraktStatus.setText(BUNDLE.getString("Settings.trakt.status.bad")); //$NON-NLS-1$ } btnGetTraktPin.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // open the pin url in a browser try { TmmUIHelper.browseUrl("https://trakt.tv/pin/799"); } catch (Exception e1) { // browser could not be opened, show a dialog box JOptionPane.showMessageDialog(MainWindow.getFrame(), BUNDLE.getString("Settings.trakt.getpin.fallback"), //$NON-NLS-1$ BUNDLE.getString("Settings.trakt.getpin"), JOptionPane.INFORMATION_MESSAGE); } // let the user insert the pin String pin = JOptionPane.showInputDialog(MainWindow.getFrame(), BUNDLE.getString("Settings.trakt.getpin.entercode")); //$NON-NLS-1$ // try to get the tokens String accessToken = ""; String refreshToken = ""; try { Map<String, String> tokens = TraktTv.authenticateViaPin(pin); accessToken = tokens.get("accessToken") == null ? "" : tokens.get("accessToken"); refreshToken = tokens.get("refreshToken") == null ? "" : tokens.get("refreshToken"); } catch (Exception e1) { } Globals.settings.setTraktAccessToken(accessToken); Globals.settings.setTraktRefreshToken(refreshToken); if (StringUtils.isNoneBlank(Globals.settings.getTraktAccessToken(), Globals.settings.getTraktRefreshToken())) { lblTraktStatus.setText(BUNDLE.getString("Settings.trakt.status.good")); //$NON-NLS-1$ } else { JOptionPane.showMessageDialog(MainWindow.getFrame(), BUNDLE.getString("Settings.trakt.getpin.problem"), BUNDLE.getString("Settings.trakt.getpin"), JOptionPane.ERROR_MESSAGE);//$NON-NLS-1$ lblTraktStatus.setText(BUNDLE.getString("Settings.trakt.status.bad")); //$NON-NLS-1$ } } }); btnTestTraktConnection.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { TraktTv.refreshAccessToken(); JOptionPane.showMessageDialog(MainWindow.getFrame(), BUNDLE.getString("Settings.trakt.testconnection.good"), BUNDLE.getString("Settings.trakt.testconnection"), JOptionPane.ERROR_MESSAGE);//$NON-NLS-1$ } catch (Exception e1) { JOptionPane.showMessageDialog(MainWindow.getFrame(), BUNDLE.getString("Settings.trakt.testconnection.bad"), BUNDLE.getString("Settings.trakt.testconnection"), JOptionPane.ERROR_MESSAGE);//$NON-NLS-1$ } } }); } } initDataBindings(); }
From source file:org.trzcinka.intellitrac.view.toolwindow.tickets.ticket_editor.AttachmentsListCellRenderer.java
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (!(value instanceof Attachment)) { throw new IllegalArgumentException( "AttachmentsListCellRenderer may render only Attachments, not " + value.getClass().getName()); }//from ww w.ja va 2 s . c om Attachment attachment = (Attachment) value; final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); ListCellRendererUtils.applyDefaultDisplaySettings(list, index, isSelected, cellHasFocus, panel); JLabel fileName = new JLabel(attachment.getFileName()); fileName.setForeground(panel.getForeground()); panel.add(fileName); String additionalTextString = MessageFormat.format( BundleLocator.getBundle() .getString("tool_window.tickets.ticket_editor.attachments.attachment_info"), FileUtils.byteCountToDisplaySize(attachment.getSize()), attachment.getAuthor()); JLabel additionalText = new JLabel(additionalTextString); additionalText.setForeground(panel.getForeground()); panel.add(additionalText); return panel; }
From source file:org.ut.biolab.medsavant.client.filter.FilterEffectivenessPanel.java
public FilterEffectivenessPanel(Color foregroundColor) { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0;// w ww . ja v a 2 s . com gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; this.setPreferredSize(new Dimension(280, 80)); this.setMaximumSize(new Dimension(280, 80)); setLayout(new GridBagLayout()); waitPanel = new WaitPanel("Applying Filters"); waitPanel.setVisible(false); add(waitPanel, gbc, JLayeredPane.DRAG_LAYER); panel = ViewUtil.getClearPanel(); panel.setLayout(new BorderLayout()); panel.setBorder(ViewUtil.getMediumBorder()); //panel.setPreferredSize(waitPanel.getPreferredSize()); add(panel, gbc, JLayeredPane.DEFAULT_LAYER); labelVariantsRemaining = ViewUtil.getDetailTitleLabel(""); labelVariantsRemaining.setForeground(foregroundColor); JPanel infoPanel = ViewUtil.getClearPanel(); ViewUtil.applyVerticalBoxLayout(infoPanel); final JLabel a = new JLabel(""); a.setForeground(foregroundColor); ViewUtil.makeSmall(a); infoPanel.add(ViewUtil.centerHorizontally(a)); Listener<FilterEvent> fe = new Listener<FilterEvent>() { @Override public void handleEvent(FilterEvent event) { try { if (MedSavantClient.VariantManager.willApproximateCountsForConditions( LoginController.getSessionID(), ProjectController.getInstance().getCurrentProjectID(), ReferenceController.getInstance().getCurrentReferenceID(), FilterController.getInstance().getAllFilterConditions())) { a.setText("approximately"); } else { a.setText(""); } } catch (Exception ex) { ex.printStackTrace(); } } }; fe.handleEvent(null); FilterController.getInstance().addListener(fe); infoPanel.add(ViewUtil.centerHorizontally(labelVariantsRemaining)); JLabel l = new JLabel("of all variants pass search conditions"); l.setForeground(foregroundColor); ViewUtil.makeSmall(l); infoPanel.add(ViewUtil.centerHorizontally(l)); infoPanel.setBorder(ViewUtil.getMediumTopHeavyBorder()); panel.add(infoPanel, BorderLayout.NORTH); initListeners(); }
From source file:org.ut.biolab.medsavant.client.view.component.KeyValuePairPanel.java
private JLabel getNullLabel() { //JPanel p = ViewUtil.getClearPanel(); JLabel l = new JLabel("NULL"); l.setForeground(Color.red); ViewUtil.makeSmall(l);// w w w. j a v a2s .c o m //p.add(ViewUtil.alignLeft(l)); return l; }
From source file:pl.otros.logview.gui.markers.editor.StringRegexMarkerEditor.java
public StringRegexMarkerEditor() { markersContainser = AllPluginables.getInstance().getMarkersContainser(); saveEnableListener = new SaveEnableListener(); chooser = new JFileChooser("./plugins/markers"); chooser.setMultiSelectionEnabled(false); fileFilterString = new MarkerFileFilter(); chooser.setFileFilter(fileFilterString); GridBagLayout bagLayout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); this.setLayout(bagLayout); TestAfterChangeActionListener testAfterChangeActionListener = new TestAfterChangeActionListener(); loadButton = new JButton("Load"); loadButton.addActionListener(new LoadctionListener()); saveButton = new JButton("Save"); saveButton.addActionListener(new SaveActionListener()); saveAsButton = new JButton("Save as"); saveAsButton.addActionListener(new SaveAsActionListener()); newButton = new JButton("New"); newButton.addActionListener(new NewMarkerActionListener()); type = new JComboBox(new String[] { "String matcher", "Regex matcher" }); type.addActionListener(new ActionListener() { @Override//from w ww .ja v a2 s . c o m public void actionPerformed(ActionEvent arg0) { if (type.getSelectedIndex() == 0) { preConditionLabel.setEnabled(false); preCondition.setEnabled(false); } else { preConditionLabel.setEnabled(true); preCondition.setEnabled(true); } } }); type.addActionListener(testAfterChangeActionListener); type.addActionListener(saveEnableListener); int testLines = 3; testFields = new JTextField[3]; testResults = new JLabel[3]; for (int i = 0; i < testLines; i++) { testFields[i] = new JTextField(20); testFields[i].getDocument().addDocumentListener(testAfterChangeActionListener); testResults[i] = new JLabel("?"); } file = new JTextField(20); file.setEditable(false); file.getDocument().addDocumentListener(saveEnableListener); name = new JTextField(20); description = new JTextField(20); condition = new JTextField(20); condition.getDocument().addDocumentListener(testAfterChangeActionListener); preCondition = new JTextField(20); preCondition.getDocument().addDocumentListener(testAfterChangeActionListener); ignoreCase = new JCheckBox(); ignoreCase.addActionListener(testAfterChangeActionListener); include = new JCheckBox(); include.addActionListener(testAfterChangeActionListener); groups = new JTextField(20); colors = new JComboBox(MarkerColors.values()); colors.setRenderer(new MarkerColorsComboBoxRenderer()); c.gridwidth = 1; c.insets = new Insets(4, 4, 4, 4); this.add(saveButton, c); c.gridx = 1; this.add(saveAsButton, c); c.gridy++; c.gridy++; c.gridx = 0; this.add(newButton, c); c.gridx = 1; this.add(loadButton, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Type:"), type, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("File:"), file, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Name:"), name, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Description:"), description, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Groups:"), groups, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Condition:"), condition, c); c.gridy++; this.addFormLabelsLeftLong(preConditionLabel, preCondition, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Ignore case:"), ignoreCase, c); c.gridy++; this.addFormLabelsLeftLong(includeLabel, include, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Color"), colors, c); c.gridy++; this.addFormLabelsRightLong(new JLabel("Test lines"), new JLabel("Result"), c); c.gridy++; for (int i = 0; i < testLines; i++) { this.addFormLabelsRightLong(testFields[i], testResults[i], c); c.gridy++; } JLabel warningLabel = new JLabel("Warning, restart application to reload changes."); warningLabel.setForeground(Color.RED); warningLabel.setOpaque(false); c.gridx = 0; c.gridwidth = 3; this.add(warningLabel, c); type.setSelectedIndex(0); newMarker(); }
From source file:Proiect.uploadFTP.java
public void actionFTP() { adressf.addCaretListener(new CaretListener() { public void caretUpdate(CaretEvent e) { InetAddress thisIp;/*from w w w. j a va2s . c om*/ try { thisIp = InetAddress.getLocalHost(); titleFTP.setText("Connection: " + thisIp.getHostAddress() + " -> " + adressf.getText()); } catch (UnknownHostException e1) { e1.printStackTrace(); } } }); exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { saveState(); uploadFTP.dispose(); tree.dispose(); } }); connect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { FTPClient client = new FTPClient(); FileInputStream fis = null; String pass = String.valueOf(passf.getPassword()); try { if (filename == null) { status.setText("File does not exist!"); } else { // Server address client.connect(adressf.getText()); // Login credentials client.login(userf.getText(), pass); if (client.isConnected()) { status.setText("Succesfull transfer!"); // File type client.setFileType(FTP.BINARY_FILE_TYPE); // File location File file = new File(filepath); fis = new FileInputStream(file); // Change the folder on the server client.changeWorkingDirectory(folderf.getText()); // Save the file on the server client.storeFile(filename, fis); } else { status.setText("Transfer failed!"); } } client.logout(); } catch (IOException e1) { Encrypter.printException(e1); } finally { try { if (fis != null) { fis.close(); } client.disconnect(); } catch (IOException e1) { Encrypter.printException(e1); } } } }); browsef.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int retval = chooserf.showOpenDialog(chooserf); if (retval == JFileChooser.APPROVE_OPTION) { status.setText(""); filename = chooserf.getSelectedFile().getName().toString(); filepath = chooserf.getSelectedFile().getPath(); filenf.setText(chooserf.getSelectedFile().getName().toString()); } } }); adv.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tree.setSize(220, uploadFTP.getHeight()); tree.setLocation(uploadFTP.getX() + 405, uploadFTP.getY()); tree.setResizable(false); tree.setIconImage(Toolkit.getDefaultToolkit() .getImage(getClass().getClassLoader().getResource("assets/ico.png"))); tree.setUndecorated(true); tree.getRootPane().setBorder(BorderFactory.createLineBorder(Encrypter.color_black, 2)); tree.setVisible(true); tree.setLayout(new BorderLayout()); JLabel labeltree = new JLabel("Server documents"); labeltree.setOpaque(true); labeltree.setBackground(Encrypter.color_light); labeltree.setBorder(BorderFactory.createMatteBorder(8, 10, 10, 0, Encrypter.color_light)); labeltree.setForeground(Encrypter.color_blue); labeltree.setFont(Encrypter.font16); JButton refresh = new JButton(""); ImageIcon refresh_icon = getImageIcon("assets/icons/refresh.png"); refresh.setIcon(refresh_icon); refresh.setBackground(Encrypter.color_light); refresh.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); refresh.setForeground(Encrypter.color_black); refresh.setFont(Encrypter.font16); refresh.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); final FTPClient client = new FTPClient(); DefaultMutableTreeNode top = new DefaultMutableTreeNode(adressf.getText()); DefaultMutableTreeNode files = null; DefaultMutableTreeNode leaf = null; final JTree tree_view = new JTree(top); tree_view.setForeground(Encrypter.color_black); tree_view.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); tree_view.putClientProperty("JTree.lineStyle", "None"); tree_view.setBackground(Encrypter.color_light); JScrollPane scrolltree = new JScrollPane(tree_view); scrolltree.setBackground(Encrypter.color_light); scrolltree.getVerticalScrollBar().setPreferredSize(new Dimension(0, 0)); UIManager.put("Tree.textBackground", Encrypter.color_light); UIManager.put("Tree.selectionBackground", Encrypter.color_blue); UIManager.put("Tree.selectionBorderColor", Encrypter.color_blue); tree_view.updateUI(); final String pass = String.valueOf(passf.getPassword()); try { client.connect(adressf.getText()); client.login(userf.getText(), pass); client.enterLocalPassiveMode(); if (client.isConnected()) { try { FTPFile[] ftpFiles = client.listFiles(); for (FTPFile ftpFile : ftpFiles) { files = new DefaultMutableTreeNode(ftpFile.getName()); top.add(files); if (ftpFile.getType() == FTPFile.DIRECTORY_TYPE) { FTPFile[] ftpFiles1 = client.listFiles(ftpFile.getName()); for (FTPFile ftpFile1 : ftpFiles1) { leaf = new DefaultMutableTreeNode(ftpFile1.getName()); files.add(leaf); } } } } catch (IOException e1) { Encrypter.printException(e1); } client.disconnect(); } else { status.setText("Failed connection!"); } } catch (IOException e1) { Encrypter.printException(e1); } finally { try { client.disconnect(); } catch (IOException e1) { Encrypter.printException(e1); } } tree.add(labeltree, BorderLayout.NORTH); tree.add(scrolltree, BorderLayout.CENTER); tree.add(refresh, BorderLayout.SOUTH); uploadFTP.addComponentListener(new ComponentListener() { public void componentMoved(ComponentEvent e) { tree.setLocation(uploadFTP.getX() + 405, uploadFTP.getY()); } public void componentShown(ComponentEvent e) { } public void componentResized(ComponentEvent e) { } public void componentHidden(ComponentEvent e) { } }); uploadFTP.addWindowListener(new WindowListener() { public void windowActivated(WindowEvent e) { tree.toFront(); } public void windowOpened(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } public void windowClosing(WindowEvent e) { } public void windowClosed(WindowEvent e) { } }); refresh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tree.dispose(); tree.setVisible(true); } }); } }); }
From source file:qic.ui.ManualPanel.java
@SuppressWarnings("serial") public ManualPanel(Main main) { super(new BorderLayout(5, 5)); table.setDoubleBuffered(true);/*from w w w . ja v a 2s. co m*/ JTextField searchTf = new JTextField(100); JButton runBtn = new JButton("Run"); runBtn.setPreferredSize(new Dimension(200, 10)); JLabel invalidTermsLblLbl = new JLabel(); invalidTermsLblLbl.setFont(invalidTermsLblLbl.getFont().deriveFont(Font.BOLD)); JLabel invalidTermsLbl = new JLabel(); invalidTermsLbl.setForeground(Color.RED); JPanel northPanel = new JPanel(); northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.X_AXIS)); JLabel searchLbl = new JLabel(" Search: "); searchLbl.setFont(searchLbl.getFont().deriveFont(Font.BOLD)); northPanel.add(searchLbl); northPanel.add(searchTf); northPanel.add(invalidTermsLblLbl); northPanel.add(invalidTermsLbl); northPanel.add(runBtn); this.add(northPanel, BorderLayout.NORTH); List<String> searchList = Util.loadSearchList(MANUAL_TXT_FILENAME); searchList.stream().forEach(searchJListModel::addElement); searchJList.setModel(searchJListModel); searchJList.addListSelectionListener(e -> { if (e.getValueIsAdjusting()) { searchTf.setText(trimToEmpty(searchJList.getSelectedValue())); } }); searchJList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { if (evt.getClickCount() == 2) { int index = searchJList.locationToIndex(evt.getPoint()); if (index != -1) { String search = trimToEmpty(searchJListModel.getElementAt(index)); searchTf.setText(search); runBtn.doClick(); } } } }); searchJList.getInputMap().put(KeyStroke.getKeyStroke("DELETE"), "doSomething"); searchJList.getActionMap().put("doSomething", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { int selectedIndex = searchJList.getSelectedIndex(); if (selectedIndex != -1) { searchJListModel.remove(selectedIndex); } } }); ActionListener runCommand = e -> { String tfText = searchTf.getText().trim(); if (!tfText.isEmpty()) { Worker<Command> worker = new Worker<Command>(() -> { runBtn.setEnabled(false); Command result = null; try { result = runQuery(main, tfText); } catch (Exception ex) { runBtn.setEnabled(true); SwingUtil.showError(ex); } return result; }, command -> { if (command != null) { if (command.invalidSearchTerms.isEmpty()) { addDataToTable(command); saveSearchToList(tfText); invalidTermsLbl.setText(""); invalidTermsLblLbl.setText(""); if (getBooleanProperty(MANUAL_AUTO_VERIFY, false)) { long sleep = Config.getLongProperty(Config.MANUAL_AUTO_VERIFY_SLEEP, 5000); table.runAutoVerify(sleep); } } else { String invalidTermsStr = command.invalidSearchTerms.stream().collect(joining(", ")); invalidTermsLbl.setText(invalidTermsStr + " "); invalidTermsLblLbl.setText(" Invalid: "); } } runBtn.setEnabled(true); }); worker.execute(); } }; searchTf.addActionListener(runCommand); runBtn.addActionListener(runCommand); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(table), new JScrollPane(searchJList)); this.add(splitPane, BorderLayout.CENTER); }