Java Code Examples for javax.swing.JColorChooser#showDialog()
The following examples show how to use
javax.swing.JColorChooser#showDialog() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LightColoursFrame.java From game-to-philips-hue with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent event) { Color lightColour = JColorChooser.showDialog(getContentPane(), "Choose Bulb Color", getBackground()); if (lightColour !=null) { int selectedBulb = lightIdentifiersList.getSelectedIndex(); if (selectedBulb !=-1) { int selectedIndex= lightIdentifiersList.getSelectedIndex(); String lightIdentifer = allLights.get(selectedIndex).getIdentifier(); PHLightState lightState = new PHLightState(); float xy[] = PHUtilities.calculateXYFromRGB(lightColour.getRed(), lightColour.getGreen(), lightColour.getBlue(), "LCT001"); lightState.setX(xy[0]); lightState.setY(xy[1]); phHueSDK.getSelectedBridge().updateLightState(lightIdentifer, lightState, null); // null is passed here as we are not interested in the response from the Bridge. } } }
Example 2
Source File: Test4759934.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); if (CMD_DIALOG.equals(command)) { JDialog dialog = new JDialog(this.frame, "Dialog"); // NON-NLS: dialog title dialog.setLocation(200, 0); show(dialog, CMD_CHOOSER); } else if (CMD_CHOOSER.equals(command)) { Object source = event.getSource(); Component component = (source instanceof Component) ? (Component) source : null; JColorChooser.showDialog(component, "ColorChooser", Color.BLUE); // NON-NLS: title } }
Example 3
Source File: Test4759934.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); if (CMD_DIALOG.equals(command)) { JDialog dialog = new JDialog(this.frame, "Dialog"); // NON-NLS: dialog title dialog.setLocation(200, 0); show(dialog, CMD_CHOOSER); } else if (CMD_CHOOSER.equals(command)) { Object source = event.getSource(); Component component = (source instanceof Component) ? (Component) source : null; JColorChooser.showDialog(component, "ColorChooser", Color.BLUE); // NON-NLS: title } }
Example 4
Source File: Test4759934.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); if (CMD_DIALOG.equals(command)) { JDialog dialog = new JDialog(this.frame, "Dialog"); // NON-NLS: dialog title dialog.setLocation(200, 0); show(dialog, CMD_CHOOSER); } else if (CMD_CHOOSER.equals(command)) { Object source = event.getSource(); Component component = (source instanceof Component) ? (Component) source : null; JColorChooser.showDialog(component, "ColorChooser", Color.BLUE); // NON-NLS: title } }
Example 5
Source File: DefaultAxisEditor.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Allows the user the opportunity to change the outline paint. */ private void attemptModifyLabelPaint() { Color c; c = JColorChooser.showDialog( this, localizationResources.getString("Label_Color"), Color.blue ); if (c != null) { this.labelPaintSample.setPaint(c); } }
Example 6
Source File: DefaultPlotEditor.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Allow the user to change the outline paint. We use JColorChooser, so * the user can only choose colors (a subset of all possible paints). */ private void attemptOutlinePaintSelection() { Color c; c = JColorChooser.showDialog(this, localizationResources.getString( "Outline_Color"), Color.blue); if (c != null) { this.outlinePaintSample.setPaint(c); } }
Example 7
Source File: FrmPolylineSymbolSet.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
private void jLabel_SymbolColorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel_SymbolColorMouseClicked // TODO add your handling code here: Color aColor = JColorChooser.showDialog(rootPane, null, this.jLabel_SymbolColor.getBackground()); this.jLabel_SymbolColor.setBackground(aColor); _polylineBreak.setSymbolColor(aColor); if (_parent.getClass() == LegendView.class) { ((LegendView) _parent).setLegendBreak_SymbolColor(aColor); } }
Example 8
Source File: DefaultAxisEditor.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Allows the user the opportunity to change the outline paint. */ private void attemptModifyLabelPaint() { Color c; c = JColorChooser.showDialog( this, localizationResources.getString("Label_Color"), Color.blue ); if (c != null) { this.labelPaintSample.setPaint(c); } }
Example 9
Source File: DefaultTitleEditor.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Allow the user the opportunity to select a Paint object. For now, we * just use the standard color chooser - all colors are Paint objects, but * not all Paint objects are colors (later we can implement a more general * Paint chooser). */ public void attemptPaintSelection() { Paint p = this.titlePaint.getPaint(); Color defaultColor = (p instanceof Color ? (Color) p : Color.blue); Color c = JColorChooser.showDialog( this, localizationResources.getString("Title_Color"), defaultColor ); if (c != null) { this.titlePaint.setPaint(c); } }
Example 10
Source File: FrmPointSymbolSet.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
private void jLabel_ColorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel_ColorMouseClicked // TODO add your handling code here: Color aColor = JColorChooser.showDialog(rootPane, null, this.jLabel_Color.getBackground()); this.jLabel_Color.setBackground(aColor); _pointBreak.setColor(aColor); if (_parent.getClass() == LegendView.class) { ((LegendView) _parent).setLegendBreak_Color(aColor); } }
Example 11
Source File: DefaultChartEditor.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Allows the user the opportunity to select a new background paint. Uses * JColorChooser, so we are only allowing a subset of all Paint objects to * be selected (fix later). */ private void attemptModifyBackgroundPaint() { Color c; c = JColorChooser.showDialog(this, localizationResources.getString( "Background_Color"), Color.blue); if (c != null) { this.background.setPaint(c); } }
Example 12
Source File: ColorButton.java From wpcleaner with Apache License 2.0 | 5 votes |
/** * Choose color. * * @param e Event. */ @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(getParent(), title, getColor()); if (color != null) { setColor(color); } }
Example 13
Source File: JTagsDialog.java From jeveassets with GNU General Public License v2.0 | 5 votes |
@Override public void actionPerformed(ActionEvent e) { jWindow.setVisible(false); TagIcon icon = (TagIcon) jButton.getIcon(); Color background = JColorChooser.showDialog(owner, GuiShared.get().background(), icon.getTagColor().getBackground()); if (background == null) { return; } Color foreground = JColorChooser.showDialog(owner, GuiShared.get().foreground(), icon.getTagColor().getForeground()); if (foreground == null) { return; } icon = new TagIcon(new TagColor(background, foreground)); jButton.setIcon(icon); }
Example 14
Source File: DefaultTitleEditor.java From opensim-gui with Apache License 2.0 | 5 votes |
/** * Allow the user the opportunity to select a Paint object. For now, we * just use the standard color chooser - all colors are Paint objects, but * not all Paint objects are colors (later we can implement a more general * Paint chooser). */ public void attemptPaintSelection() { Paint p = this.titlePaint.getPaint(); Color defaultColor = (p instanceof Color ? (Color) p : Color.blue); Color c = JColorChooser.showDialog( this, localizationResources.getString("Title_Color"), defaultColor ); if (c != null) { this.titlePaint.setPaint(c); } }
Example 15
Source File: DefaultPlotEditor.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Allow the user to change the outline paint. We use JColorChooser, so * the user can only choose colors (a subset of all possible paints). */ private void attemptOutlinePaintSelection() { Color c; c = JColorChooser.showDialog(this, localizationResources.getString( "Outline_Color"), Color.blue); if (c != null) { this.outlinePaintSample.setPaint(c); } }
Example 16
Source File: CharGroupListColor.java From MesquiteCore with GNU Lesser General Public License v3.0 | 5 votes |
public boolean chooseColor(Color oldColor){ //so assistant can do something in response to arrow touch; return true if the event is to stop there, i.e. be intercepted if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) return true; JFrame guiFrame = new JFrame(); newColor = JColorChooser.showDialog(guiFrame, "Pick a Color", oldColor); if (newColor!=null){ return true; } return false; }
Example 17
Source File: AreaAndBarChartConfigurationPanel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
private void createItemColorDialog() { if (getSelectedValueSource() != null) { Color itemColor = getSelectedValueSource().getSeriesFormat().getItemColor(); Color newItemColor = JColorChooser.showDialog(this, I18N.getGUILabel("plotter.configuration_dialog.choose_color.label"), itemColor); if (newItemColor != null && !(newItemColor.equals(itemColor))) { getSelectedValueSource().getSeriesFormat().setItemColor(newItemColor); } } }
Example 18
Source File: NamedColorEditor.java From ramus with GNU General Public License v3.0 | 5 votes |
/** * */ protected void selectColor() { final Color c = JColorChooser.showDialog(this, null, Options.getColor(name, jPanel2.getBackground())); if (c != null) jPanel2.setBackground(c); }
Example 19
Source File: Test6541987.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void run() { String title = getClass().getName(); JFrame frame = new JFrame(title); frame.setVisible(true); Color color = JColorChooser.showDialog(frame, title, Color.BLACK); if (color != null) { throw new Error("unexpected color: " + color); } frame.setVisible(false); frame.dispose(); }
Example 20
Source File: BulbPanel.java From ThingML-Tradfri with Apache License 2.0 | 4 votes |
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed Color c = JColorChooser.showDialog(null, "Choose a color", Color.WHITE); if (c != null) { bulb.setRGBColor(c.getRed(), c.getGreen(), c.getBlue()); } }