List of usage examples for javax.swing JButton setForeground
@BeanProperty(preferred = true, visualUpdate = true, description = "The foreground color of the component.") public void setForeground(Color fg)
From source file:com.diversityarrays.kdxplore.vistool.VisToolbarFactory.java
static public VisToolToolBar create(final String title, final JComponent comp, final Closure<File> snapshotter, final VisToolDataProvider visToolDataProvider, boolean floatable, final String[] imageSuffixes) { Window window = GuiUtil.getOwnerWindow(comp); boolean anyButtons = false; final JCheckBox keepOnTop; if (window == null) { keepOnTop = null;/* w ww .j a va 2s . co m*/ } else { anyButtons = true; keepOnTop = new JCheckBox(Msg.OPTION_KEEP_ON_TOP(), true); keepOnTop.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { window.setAlwaysOnTop(keepOnTop.isSelected()); } }); window.setAlwaysOnTop(keepOnTop.isSelected()); // buttons.add(keepOnTop); final PropertyChangeListener alwaysOnTopListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { keepOnTop.setSelected(window.isAlwaysOnTop()); } }; window.addPropertyChangeListener(PROPERTY_ALWAYS_ON_TOP, alwaysOnTopListener); window.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { window.removeWindowListener(this); window.removePropertyChangeListener(PROPERTY_ALWAYS_ON_TOP, alwaysOnTopListener); } }); } final JButton cameraButton; if (snapshotter == null) { cameraButton = null; } else { Action cameraAction = new AbstractAction(Msg.ACTION_SNAPSHOT()) { @Override public void actionPerformed(ActionEvent e) { if (chooser == null) { chooser = new JFileChooser(); chooser.setFileFilter(new FileFilter() { @Override public boolean accept(File f) { if (!f.isFile()) { return true; } String loname = f.getName().toLowerCase(); for (String sfx : imageSuffixes) { if (loname.endsWith(sfx)) { return true; } } return false; } @Override public String getDescription() { return Msg.DESC_IMAGE_FILE(); } }); chooser.setMultiSelectionEnabled(false); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); } if (JFileChooser.APPROVE_OPTION == chooser.showSaveDialog(comp)) { File file = chooser.getSelectedFile(); snapshotter.execute(file); } } }; ImageIcon icon = loadIcon("camera-24.png"); //$NON-NLS-1$ if (icon != null) { cameraAction.putValue(Action.SMALL_ICON, icon); cameraAction.putValue(Action.NAME, null); } anyButtons = true; cameraButton = new JButton(cameraAction); } final JButton refreshButton; if (visToolDataProvider == null) { refreshButton = null; } else { anyButtons = true; refreshButton = new JButton(Msg.ACTION_REFRESH()); ImageIcon icon = loadIcon("refresh-24.png"); //$NON-NLS-1$ if (icon != null) { refreshButton.setIcon(icon); // don't remove the name } refreshButton.setForeground(Color.RED); refreshButton.setEnabled(false); refreshButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (visToolDataProvider.refreshData()) { refreshButton.setEnabled(false); } } }); visToolDataProvider.addVisToolDataChangedListener(new VisToolDataChangedListener() { @Override public void visToolDataChanged(Object source) { refreshButton.setEnabled(true); } }); } VisToolToolBar toolBar = null; if (anyButtons) { toolBar = new VisToolToolBar(keepOnTop, cameraButton, refreshButton); toolBar.setFloatable(floatable); } return toolBar; }
From source file:cool.pandora.modeller.ui.BagTableFormBuilder.java
/** * addBinding.// w w w . j av a2s . c om * * @param isRequired boolean * @param labelName String * @param component JComponent * @param removeButton JComponent * @return JComponent */ private JComponent[] addBinding(final boolean isRequired, final String labelName, final JComponent component, final JComponent removeButton) { removeButton.setFocusable(false); final JLabel label = new JLabel(labelName); // createLabelFor(fieldName, // component); label.setToolTipText("Double-Click to Edit"); final TableLayoutBuilder layoutBuilder = getLayoutBuilder(); if (!layoutBuilder.hasGapToLeft()) { layoutBuilder.gapCol(); } layoutBuilder.cell(label, "colSpec=left:pref:noGrow"); final JComponent reqComp; /* */ if (isRequired) { final JButton b = new JButton("R"); b.setForeground(Color.red); b.setOpaque(false); b.setBorderPainted(false); reqComp = b; } else { final JButton b = new JButton(""); b.setOpaque(false); b.setBorderPainted(false); reqComp = b; } /* */ reqComp.setFocusable(false); layoutBuilder.cell(reqComp, "colSpec=left:pref:noGrow"); layoutBuilder.cell(component, "colSpec=fill:pref:grow"); layoutBuilder.labelGapCol(); layoutBuilder.cell(removeButton, "colSpec=left:pref:noGrow"); layoutBuilder.labelGapCol(); return new JComponent[] { label, reqComp, component, removeButton }; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelDeleteButton(String text) { JButton btn = new JButton(text); btn.setUI(new IntelButtonUI(UIConstants.INTEL_MEDIUM_RED, UIConstants.INTEL_MEDIUM_DARK_RED)); btn.setBackground(UIConstants.INTEL_RED); btn.setForeground(UIConstants.INTEL_WHITE); // btn.setFont(UIConstants.H5_FONT); return btn;/*from w ww . j a v a2 s .c om*/ }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelDeleteButton(AbstractAction action) { JButton btn = new JButton(action); btn.setUI(new IntelButtonUI(UIConstants.INTEL_MEDIUM_RED, UIConstants.INTEL_MEDIUM_DARK_RED)); btn.setBackground(UIConstants.INTEL_RED); btn.setForeground(UIConstants.INTEL_WHITE); // btn.setFont(UIConstants.H5_FONT); return btn;//from w ww .j av a 2 s. co m }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelActionButton(String text) { JButton btn = new JButton(text); btn.setUI(new IntelButtonUI(UIConstants.INTEL_MEDIUM_BLUE, UIConstants.INTEL_MEDIUM_DARK_BLUE)); btn.setBackground(UIConstants.INTEL_BLUE); btn.setForeground(UIConstants.INTEL_WHITE); // btn.setFont(UIConstants.H5_FONT); return btn;/* ww w.j a v a 2 s . c o m*/ }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelActionButton(String text, Icon icon) { JButton btn = new JButton(text); btn.setUI(new IntelButtonUI(UIConstants.INTEL_MEDIUM_BLUE, UIConstants.INTEL_MEDIUM_DARK_BLUE)); btn.setBackground(UIConstants.INTEL_BLUE); btn.setForeground(UIConstants.INTEL_WHITE); btn.setIcon(icon);/*w ww. j a v a 2 s . c om*/ return btn; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelActionButton(AbstractAction action) { JButton btn = new JButton(action); btn.setUI(new IntelButtonUI(UIConstants.INTEL_MEDIUM_BLUE, UIConstants.INTEL_MEDIUM_DARK_BLUE)); btn.setBackground(UIConstants.INTEL_BLUE); btn.setForeground(UIConstants.INTEL_WHITE); return btn;/*from w w w . j ava2s . c om*/ }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelCancelButton(String text) { JButton btn = new JButton(text); btn.setUI(new IntelButtonUI(UIConstants.INTEL_BACKGROUND_GRAY, UIConstants.INTEL_LIGHT_GRAY)); btn.setBackground(UIConstants.INTEL_TABLE_BORDER_GRAY); btn.setForeground(UIConstants.INTEL_DARK_GRAY); // btn.setFont(UIConstants.H5_FONT); return btn;//ww w .j a va 2 s . co m }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelCancelButton(AbstractAction action) { JButton btn = new JButton(action); btn.setUI(new IntelButtonUI(UIConstants.INTEL_BACKGROUND_GRAY, UIConstants.INTEL_LIGHT_GRAY)); btn.setBackground(UIConstants.INTEL_TABLE_BORDER_GRAY); btn.setForeground(UIConstants.INTEL_DARK_GRAY); // btn.setFont(UIConstants.H5_FONT); return btn;/* ww w . j a v a2 s . c om*/ }
From source file:sanger.team16.gui.genevar.eqtl.snp.CisEQTLSNPPane2.java
private void setTranscriptPanel(String variationName, ChartPanel regionalLinePlot) throws ArrayIndexOutOfBoundsException { BaseJPane panel = new BaseJPane(variationName, 10, 20, 10, 20); // ------------------ Panel p0 (start) ------------------ // BaseJPane p0 = new BaseJPane(); p0.add(regionalLinePlot);/* w w w. j a v a2s .c o m*/ //p0.setBaseSpringBoxTrailing(); panel.add(p0); // ------------------ Panel p0 (end) ------------------ // panel.add(new JLabel("")); panel.add(new JLabel("")); panel.add(new JLabel("")); // ------------------ Panel p1 (start) ------------------ // BaseJPane p1 = new BaseJPane(); JButton bSelectAll = new JButton(" Deselect All "); JButton bExport = new JButton(" Export List "); CisSNPPane2Listener cisSNP2Listener = new CisSNPPane2Listener(bSelectAll, bExport); //bSelectAll.setForeground(new Color(34,139,34)); bSelectAll.setForeground(Color.GREEN.darker()); bSelectAll.addActionListener(cisSNP2Listener); p1.add(bSelectAll); bExport.addActionListener(cisSNP2Listener); p1.add(bExport); p1.add(Box.createHorizontalGlue()); this.setLinkToPanel(p1, assemblyId, snp.getChromosome(), snp.getPosition(), distanceToSNP); p1.setBaseSpringBox(); panel.add(p1); // ------------------ Panel p1 (end) ------------------ // // ------------------ Panel p2 (start) ------------------ // //BaseJTable transcriptTable = this.transcriptTable.getSortedTable(); //TODO if (transcriptTable.isEnabled()) { bSelectAll.setEnabled(false); bExport.setEnabled(false); } this.setTranscriptTable(); BaseJPane p2 = new BaseJPane(); p2.setLayout(new BorderLayout()); p2.add(transcriptTable.getTableHeader(), BorderLayout.PAGE_START); p2.add(transcriptTable, BorderLayout.CENTER); //p0.setBaseSpringGrid(1, 1); panel.add(p2); // ------------------ Panel p2 (end) ------------------ // panel.add(new JLabel(" (Use CTRL+C to copy genes of interest)")); panel.setBaseSpringGrid(1); this.add(panel); }