List of usage examples for javax.swing JColorChooser showDialog
public static Color showDialog(Component component, String title, Color initialColor) throws HeadlessException
From source file:com.rapidminer.gui.new_plotter.gui.GlobalConfigurationPanel.java
private void createPlotBackgroundColorDialog() { Color oldColor = getPlotConfiguration().getPlotBackgroundColor(); if (oldColor == null) { oldColor = Color.white;/* ww w . j av a 2 s.c o m*/ } Color newBackgroundColor = JColorChooser.showDialog(this, I18N.getGUILabel( "plotter.configuration_dialog.global_config_panel.plot_background_color_title.label"), oldColor); if (newBackgroundColor != null && !newBackgroundColor.equals(oldColor)) { getPlotConfiguration().setPlotBackgroundColor(newBackgroundColor); } }
From source file:com.rapidminer.gui.new_plotter.gui.GlobalConfigurationPanel.java
private void createFrameBackgroundColorDialog() { Color oldColor = getPlotConfiguration().getChartBackgroundColor(); if (oldColor == null) { oldColor = Color.white;/*from w ww . j a v a 2s.co m*/ } Color newBackgroundColor = JColorChooser.showDialog(this, I18N.getGUILabel( "plotter.configuration_dialog.global_config_panel.chart_background_color_title.label"), oldColor); if (newBackgroundColor != null && !newBackgroundColor.equals(oldColor)) { getPlotConfiguration().setFrameBackgroundColor(newBackgroundColor); } }
From source file:cs.cirg.cida.CIDAView.java
@Action public void changeSeriesColor() { SeriesPair series = (SeriesPair) lineSeriesComboBox.getSelectedItem(); JFreeChart chart = ((ChartPanel) chartPanel).getChart(); XYPlot plot = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(series.getKey(), JColorChooser.showDialog(this.getFrame(), CIDAConstants.DIALOG_CHOOSE_COLOR_MSG, (Color) renderer.getSeriesPaint(series.getKey()))); }
From source file:org.gumtree.vis.awt.time.TimePlotChartEditor.java
/** * 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).//w ww.jav a2 s . c o m */ private void modifyCurvePaint() { Color c; c = JColorChooser.showDialog(this, "Curve Color", Color.blue); if (c != null) { curveColorPaint.setPaint(c); updateMarkerShapeLabel(c); comboRender.setPaint(c); shapeCombo.updateUI(); } }
From source file:com.floreantpos.ui.model.PizzaItemForm.java
private void initComponents() { setLayout(new BorderLayout()); JLabel lblButtonColor = new JLabel(Messages.getString("MenuItemForm.19")); //$NON-NLS-1$ tabbedPane = new javax.swing.JTabbedPane(); JPanel tabGeneral = new javax.swing.JPanel(); JLabel lblName = new JLabel(); lblName.setHorizontalAlignment(SwingConstants.TRAILING); tfName = new com.floreantpos.swing.FixedLengthTextField(20); tfDescription = new JTextArea(new FixedLengthDocument(120)); JLabel lTax = new javax.swing.JLabel(); lTax.setHorizontalAlignment(SwingConstants.TRAILING); cbTax = new javax.swing.JComboBox(); JButton btnNewTax = new javax.swing.JButton(); JPanel tabShift = new javax.swing.JPanel(); JPanel tabPrice = new javax.swing.JPanel(); JPanel tabButtonStyle = new javax.swing.JPanel(); JButton btnDeleteShift = new javax.swing.JButton(); JButton btnAddShift = new javax.swing.JButton(); JButton btnNewPrice = new javax.swing.JButton(); JButton btnUpdatePrice = new javax.swing.JButton(); JButton btnDeletePrice = new javax.swing.JButton(); JButton btnDeleteAll = new javax.swing.JButton(); JButton btnDefaultValue = new javax.swing.JButton(); JButton btnAutoGenerate = new javax.swing.JButton(); JScrollPane jScrollPane2 = new javax.swing.JScrollPane(); JScrollPane priceTabScrollPane = new javax.swing.JScrollPane(); shiftTable = new JTable(); priceTable = new JTable(); priceTable.setRowHeight(PosUIManager.getSize(priceTable.getRowHeight())); priceTable.setCellSelectionEnabled(true); priceTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); priceTable.setSurrendersFocusOnKeystroke(true); cbPrinterGroup = new JComboBox<PrinterGroup>(new DefaultComboBoxModel<PrinterGroup>( PrinterGroupDAO.getInstance().findAll().toArray(new PrinterGroup[0]))); cbPrinterGroup.setPreferredSize(new Dimension(226, 0)); tfDefaultSellPortion = new IntegerTextField(10); tfTranslatedName = new FixedLengthTextField(20); tfTranslatedName.setLength(120);//w w w.j a v a 2 s. c o m lblKitchenPrinter = new JLabel(Messages.getString("MenuItemForm.27")); //$NON-NLS-1$ lblName.setText(Messages.getString("LABEL_NAME")); //$NON-NLS-1$ tfName.setLength(120); JLabel lblTranslatedName = new JLabel(Messages.getString("MenuItemForm.lblTranslatedName.text")); //$NON-NLS-1$ tfSortOrder = new IntegerTextField(20); tfSortOrder.setText(""); //$NON-NLS-1$ cbTax.setPreferredSize(new Dimension(198, 0)); btnButtonColor = new JButton(); //$NON-NLS-1$ btnButtonColor.setPreferredSize(new Dimension(228, 40)); JLabel lblTextColor = new JLabel(Messages.getString("MenuItemForm.lblTextColor.text")); //$NON-NLS-1$ btnTextColor = new JButton(Messages.getString("MenuItemForm.SAMPLE_TEXT")); //$NON-NLS-1$ cbShowTextWithImage = new JCheckBox(Messages.getString("MenuItemForm.40")); //$NON-NLS-1$ cbShowTextWithImage.setActionCommand(Messages.getString("MenuItemForm.41")); //$NON-NLS-1$ lTax.setText(Messages.getString("LABEL_TAX")); //$NON-NLS-1$ btnNewTax.setText("..."); lTax.setText(Messages.getString("LABEL_TAX")); //$NON-NLS-1$ btnNewTax.setText("..."); //$NON-NLS-1$ btnNewTax.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNewTaxdoCreateNewTax(evt); } }); tabbedPane.addTab(com.floreantpos.POSConstants.GENERAL, tabGeneral); tabbedPane.setPreferredSize(new Dimension(750, 470)); tabbedPane.addTab(com.floreantpos.POSConstants.MODIFIER_GROUPS, getModifierGroupTab()); btnAddShift.addActionListener(this); btnDeleteShift.addActionListener(this); tabGeneral.setLayout(new MigLayout("insets 20", "[][]20px[][]", "[][][][][][][][][][][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ tabGeneral.add(lblName, "cell 0 1 ,right"); //$NON-NLS-1$ tabGeneral.add(tfName, "cell 1 1,grow"); //$NON-NLS-1$ tabGeneral.add(lblTranslatedName, "cell 0 2,right"); //$NON-NLS-1$ tabGeneral.add(tfTranslatedName, "cell 1 2,grow"); JLabel lgroup = new javax.swing.JLabel(); lgroup.setHorizontalAlignment(SwingConstants.TRAILING); lgroup.setText(Messages.getString("LABEL_GROUP")); //$NON-NLS-1$ tabGeneral.add(lgroup, "cell 0 3,alignx right"); //$NON-NLS-1$ JLabel lblBarcode = new JLabel(Messages.getString("MenuItemForm.lblBarcode.text")); //$NON-NLS-1$ tabGeneral.add(lblBarcode, "cell 0 4,alignx right"); //$NON-NLS-1$ tfBarcode = new FixedLengthTextField(20); tabGeneral.add(tfBarcode, "cell 1 4,grow"); //$NON-NLS-1$ JLabel lblStockCount = new JLabel(Messages.getString("MenuItemForm.17")); //$NON-NLS-1$ tabGeneral.add(lblStockCount, "cell 0 5,alignx right"); //$NON-NLS-1$ tfStockCount = new DoubleTextField(1); tabGeneral.add(tfStockCount, "cell 1 5,grow"); //$NON-NLS-1$ chkVisible = new javax.swing.JCheckBox(); tabGeneral.add(new JLabel("Default sell portion (%)"), "cell 0 6"); tabGeneral.add(tfDefaultSellPortion, "cell 1 6,grow"); chkVisible.setText(com.floreantpos.POSConstants.VISIBLE); chkVisible.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); chkVisible.setMargin(new java.awt.Insets(0, 0, 0, 0)); tabGeneral.add(chkVisible, "cell 1 7"); tabGeneral.add(lblKitchenPrinter, "cell 2 1,right"); //$NON-NLS-1$ tabGeneral.add(cbPrinterGroup, "cell 3 1,grow"); //$NON-NLS-1$ tabGeneral.add(lTax, "cell 2 2,right"); //$NON-NLS-1$ tabGeneral.add(cbTax, "cell 3 2"); //$NON-NLS-1$ tabGeneral.add(btnNewTax, "cell 3 2,grow"); //$NON-NLS-1$ cbGroup = new javax.swing.JComboBox(); cbGroup.setPreferredSize(new Dimension(198, 0)); tabGeneral.add(cbGroup, "flowx,cell 1 3"); //$NON-NLS-1$ JButton btnNewGroup = new javax.swing.JButton(); btnNewGroup.setText("..."); //$NON-NLS-1$ btnNewGroup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doCreateNewGroup(evt); } }); tabGeneral.add(btnNewGroup, "cell 1 3"); //$NON-NLS-1$ tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.25")), "cell 2 3,right"); //$NON-NLS-1$ //$NON-NLS-2$ orderList = new CheckBoxList(); List<OrderType> orderTypes = Application.getInstance().getOrderTypes(); orderList.setModel(orderTypes); JScrollPane orderCheckBoxList = new JScrollPane(orderList); orderCheckBoxList.setPreferredSize(new Dimension(228, 100)); tabGeneral.add(orderCheckBoxList, "cell 3 3 3 3"); //$NON-NLS-1$ cbDisableStockCount = new JCheckBox(Messages.getString("MenuItemForm.18")); //$NON-NLS-1$ tabGeneral.add(cbDisableStockCount, "cell 1 8"); //$NON-NLS-1$ tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.29")), "cell 2 6,alignx right"); //$NON-NLS-1$ //$NON-NLS-2$ JScrollPane scrlDescription = new JScrollPane(tfDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrlDescription.setPreferredSize(new Dimension(228, 70)); tfDescription.setLineWrap(true); tabGeneral.add(scrlDescription, "cell 3 6 3 3"); //$NON-NLS-1$ add(tabbedPane); //TODO: addRecepieExtension(); btnDeleteShift.setText(com.floreantpos.POSConstants.DELETE_SHIFT); btnAddShift.setText(com.floreantpos.POSConstants.ADD_SHIFT); shiftTable .setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ jScrollPane2.setViewportView(shiftTable); org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(tabShift); tabShift.setLayout(jPanel3Layout); jPanel3Layout .setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup().addContainerGap(76, Short.MAX_VALUE) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 670, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createSequentialGroup().add(btnAddShift).add(5, 5, 5) .add(btnDeleteShift))) .addContainerGap())); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup() .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 345, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(btnAddShift).add(btnDeleteShift)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); tabbedPane.addTab(com.floreantpos.POSConstants.SHIFTS, tabShift); btnNewPrice.setText(Messages.getString("MenuItemForm.9")); //$NON-NLS-1$ btnNewPrice.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addNewPrice(); } }); btnUpdatePrice.setText(Messages.getString("MenuItemForm.13")); //$NON-NLS-1$ btnUpdatePrice.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updatePrice(); } }); btnDeletePrice.setText(Messages.getString("MenuItemForm.14")); //$NON-NLS-1$ btnDeletePrice.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deletePrice(); } }); btnAutoGenerate.setText("Auto Generate"); //$NON-NLS-1$ btnAutoGenerate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { autoGeneratePizzaItemSizeAndPrice(); } }); btnDeleteAll.setText(Messages.getString("MenuItemForm.15")); //$NON-NLS-1$ btnDeleteAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteAll(); } }); btnDefaultValue.setText(Messages.getString("MenuItemForm.7")); //$NON-NLS-1$ priceTabScrollPane.setViewportView(priceTable); tabPrice.setLayout(new BorderLayout()); tabPrice.add(priceTabScrollPane, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(); buttonPanel.add(btnNewPrice); buttonPanel.add(btnUpdatePrice); buttonPanel.add(btnDeletePrice); buttonPanel.add(btnAutoGenerate); tabPrice.add(buttonPanel, BorderLayout.SOUTH); tabGeneral.add(tabPrice, "cell 0 10,grow,span"); tabbedPane.addChangeListener(this); tabButtonStyle.setLayout(new MigLayout("insets 10", "[][]100[][][][]", "[][][center][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ JLabel lblImage = new JLabel(Messages.getString("MenuItemForm.28")); //$NON-NLS-1$ lblImage.setHorizontalAlignment(SwingConstants.TRAILING); tabButtonStyle.add(lblImage, "cell 0 0,right"); //$NON-NLS-1$ lblImagePreview = new JLabel(""); //$NON-NLS-1$ lblImagePreview.setHorizontalAlignment(JLabel.CENTER); lblImagePreview.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); lblImagePreview.setPreferredSize(new Dimension(100, 100)); tabButtonStyle.add(lblImagePreview, "cell 1 0"); //$NON-NLS-1$ JButton btnSelectImage = new JButton("..."); //$NON-NLS-1$ btnClearImage = new JButton(Messages.getString("MenuItemForm.34")); //$NON-NLS-1$ tabButtonStyle.add(btnClearImage, "cell 1 0"); //$NON-NLS-1$ tabButtonStyle.add(btnSelectImage, "cell 1 0"); //$NON-NLS-1$ tabButtonStyle.add(lblButtonColor, "cell 0 2,right"); //$NON-NLS-1$ tabButtonStyle.add(btnButtonColor, "cell 1 2,grow"); //$NON-NLS-1$ tabButtonStyle.add(lblTextColor, "cell 0 3,right"); //$NON-NLS-1$ tabButtonStyle.add(btnTextColor, "cell 1 3"); //$NON-NLS-1$ tabButtonStyle.add(cbShowTextWithImage, "cell 1 4"); //$NON-NLS-1$ btnTextColor.setPreferredSize(new Dimension(228, 50)); btnSelectImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSelectImageFile(); } }); btnClearImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doClearImage(); } }); btnButtonColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(POSUtil.getBackOfficeWindow(), Messages.getString("MenuItemForm.42"), btnButtonColor.getBackground()); //$NON-NLS-1$ btnButtonColor.setBackground(color); btnTextColor.setBackground(color); } }); btnTextColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(POSUtil.getBackOfficeWindow(), Messages.getString("MenuItemForm.43"), btnTextColor.getForeground()); //$NON-NLS-1$ btnTextColor.setForeground(color); } }); tabbedPane.addTab(Messages.getString("MenuItemForm.26"), tabButtonStyle); //$NON-NLS-1$ }
From source file:net.sf.firemox.Magic.java
public void actionPerformed(ActionEvent e) { final String command = e.getActionCommand(); final Object obj = e.getSource(); if (obj == sendButton) { if (sendTxt.getText().length() != 0) { MChat.getInstance().sendMessage(sendTxt.getText() + "\n"); sendTxt.setText(""); }/* w ww . j a v a 2 s . c o m*/ } else if (command != null && command.startsWith("border-")) { for (int i = cardBorderMenu.getComponentCount(); i-- > 0;) { ((JRadioButtonMenuItem) cardBorderMenu.getComponent(i)).setSelected(false); } ((JRadioButtonMenuItem) obj).setSelected(true); CardFactory.updateColor(command.substring("border-".length())); CardFactory.updateAllCardsUI(); magicForm.repaint(); } else if ("menu_help_mailing".equals(command)) { try { WebBrowser.launchBrowser( "http://lists.sourceforge.net/lists/listinfo/" + IdConst.PROJECT_NAME + "-user"); } catch (Exception e1) { JOptionPane.showOptionDialog(this, LanguageManager.getString("error") + " : " + e1.getMessage(), LanguageManager.getString("web-pb"), JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE, UIHelper.getIcon("wiz_update_error.gif"), null, null); } } else if ("menu_options_settings".equals(command)) { // Setting panel final Wizard settingsPanel = new Settings(); settingsPanel.setVisible(true); } else if ("menu_help_check-update".equals(command)) { VersionChecker.checkVersion(this); } else if ("menu_game_new_client".equals(command)) { new net.sf.firemox.ui.wizard.Client().setVisible(true); } else if ("menu_game_new_server".equals(command)) { new net.sf.firemox.ui.wizard.Server().setVisible(true); } else if ("menu_tools_log".equals(command)) { new net.sf.firemox.ui.wizard.Log().setVisible(true); } else if ("menu_tools_featurerequest".equals(command)) { new Feature().setVisible(true); } else if ("menu_tools_bugreport".equals(command)) { new Bug().setVisible(true); } else if ("menu_game_skip".equals(command)) { if (ConnectionManager.isConnected() && skipButton.isEnabled() && StackManager.idHandedPlayer == 0) { StackManager.noReplayToken.take(); try { manualSkip(); } catch (Throwable t) { t.printStackTrace(); } finally { StackManager.noReplayToken.release(); } } } else if ("menu_game_disconnect".equals(command)) { ConnectionManager.closeConnexions(); } else if ("menu_tools_jdb".equals(command)) { DeckBuilder.loadFromMagic(); } else if ("menu_game_exit".equals(command)) { exitForm(null); } else if (obj == autoManaMenu) { /* * invoked you click directly on the "auto-mana option" of the menu * "options". The opponent has to know that we are in "auto colorless mana * use", since player will no longer click on the mana icon to define * which colored mana active player has used as colorless mana, then the * opponent have not to wait for active player choice, but apply the same * Algorithm calculating which colored manas are used as colorless manas. * This information is not sent immediately, but will be sent with the * next action of active player. */ MCommonVars.autoMana = autoManaMenu.isSelected(); } else if (obj == autoPlayMenu) { /* * invoked you click directly on the "auto-play option" of the menu * "options". */ MCommonVars.autoStack = autoPlayMenu.isSelected(); } else if ("menu_tools_jcb".equals(command)) { // TODO cardBuilderMenu -> not yet implemented Log.info("cardBuilderMenu -> not yet implemented"); } else if ("menu_game_proxy".equals(command)) { new ProxyConfiguration().setVisible(true); } else if ("menu_help_help".equals(command)) { /* * Invoked you click directly on youLabel. Opponent will receive this * information. */ try { WebBrowser.launchBrowser("http://prdownloads.sourceforge.net/" + IdConst.PROJECT_NAME + "/7e_rulebook_EN.pdf?download"); } catch (Exception e1) { JOptionPane.showOptionDialog(this, LanguageManager.getString("error") + " : " + e1.getMessage(), LanguageManager.getString("web-pb"), JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE, UIHelper.getIcon("wiz_update_error.gif"), null, null); } } else if ("menu_help_about".equals(command)) { new About(this).setVisible(true); } else if ("menu_help_about.tbs".equals(command)) { new AboutMdb(this).setVisible(true); } else if (obj == reverseArtCheck || obj == reverseSideCheck) { Configuration.setProperty("reverseArt", reverseArtCheck.isSelected()); Configuration.setProperty("reverseSide", reverseSideCheck.isSelected()); ZoneManager.updateReversed(); StackManager.PLAYERS[1].updateReversed(); repaint(); SwingUtilities.invokeLater(SkinLF.REFRESH_RUNNER); } else if (obj == soundMenu) { Configuration.setProperty("sound", soundMenu.isSelected()); soundMenu.setIcon( soundMenu.isSelected() ? UIHelper.getIcon("sound.gif") : UIHelper.getIcon("soundoff.gif")); } else if ("menu_lf_randomAngle".equals(command)) { Configuration.setProperty("randomAngle", ((AbstractButton) e.getSource()).isSelected()); CardFactory.updateAllCardsUI(); } else if ("menu_lf_powerToughnessColor".equals(command)) { final Color powerToughnessColor = JColorChooser.showDialog(this, LanguageManager.getString("menu_lf_powerToughnessColor"), CardFactory.powerToughnessColor); if (powerToughnessColor != null) { Configuration.setProperty("powerToughnessColor", powerToughnessColor.getRGB()); CardFactory.updateColor(null); repaint(); } } else if (obj == initialdelayMenu) { // TODO factor this code with the one of Magic.class final ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); new InputNumber(LanguageManager.getString("initialdelay"), LanguageManager.getString("initialdelay.tooltip"), 0, Integer.MAX_VALUE, toolTipManager.getInitialDelay()).setVisible(true); if (Wizard.optionAnswer == JOptionPane.YES_OPTION) { toolTipManager.setEnabled(Wizard.indexAnswer != 0); toolTipManager.setInitialDelay(Wizard.indexAnswer); initialdelayMenu.setText(LanguageManager.getString("initialdelay") + (toolTipManager.isEnabled() ? " : " + Wizard.indexAnswer + " ms" : "(disabled)")); Configuration.setProperty("initialdelay", Wizard.indexAnswer); } } else if (obj == dismissdelayMenu) { // TODO factor this code with the one of Magic.class final ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); new InputNumber(LanguageManager.getString("dismissdelay"), LanguageManager.getString("dismissdelay.tooltip"), 0, Integer.MAX_VALUE, toolTipManager.getDismissDelay()).setVisible(true); if (Wizard.optionAnswer == JOptionPane.YES_OPTION) { toolTipManager.setDismissDelay(Wizard.indexAnswer); Configuration.setProperty("dismissdelay", Wizard.indexAnswer); dismissdelayMenu.setText(LanguageManager.getString("dismissdelay") + Wizard.indexAnswer + " ms"); } } }
From source file:SciTK.Plot.java
/** * Choose a new color using JColorChooser dialog * @param message the message to display to user * @param init the default color/*from w w w . j a va 2s. c o m*/ * @return the user's selected color */ private Color plotColorChooser(String message, Color init) { return JColorChooser.showDialog(this, message, init); }
From source file:au.org.ala.delta.editor.ui.image.ImageSettingsDialog.java
@Action public void displayColourChooser() { Color currentDefault = _imageSettings.getCustomPopupColour(); String title = _resources.getString("hotSpotColourChooser.title"); Color newDefault = JColorChooser.showDialog(this, title, currentDefault); selectedColourLabel.setBackground(newDefault); }
From source file:com.floreantpos.ui.model.MenuItemForm.java
/** This method is called from within the constructor to * initialize the form.//from w ww . ja v a 2 s.c om * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { lblStockCount = new JLabel(Messages.getString("MenuItemForm.17")); //$NON-NLS-1$ tfStockCount = new DoubleTextField(1); cbDisableStockCount = new JCheckBox(Messages.getString("MenuItemForm.18")); //$NON-NLS-1$ lblButtonColor = new JLabel(Messages.getString("MenuItemForm.19")); //$NON-NLS-1$ tabbedPane = new javax.swing.JTabbedPane(); tabGeneral = new javax.swing.JPanel(); lfname = new javax.swing.JLabel(); lfname.setHorizontalAlignment(SwingConstants.TRAILING); tfName = new com.floreantpos.swing.FixedLengthTextField(20); lgroup = new javax.swing.JLabel(); lgroup.setHorizontalAlignment(SwingConstants.TRAILING); cbGroup = new javax.swing.JComboBox(); cbGroup.setPreferredSize(new Dimension(198, 0)); btnNewGroup = new javax.swing.JButton(); lblPrice = new javax.swing.JLabel(); lblPrice.setHorizontalAlignment(SwingConstants.TRAILING); tfPrice = new DoubleTextField(20); tfPrice.setHorizontalAlignment(javax.swing.JTextField.RIGHT); tfDescription = new JTextArea(new FixedLengthDocument(255)); //tfDescription.setDocument(; tfUnitName = new FixedLengthTextField(20); lTax = new javax.swing.JLabel(); lTax.setHorizontalAlignment(SwingConstants.TRAILING); cbTax = new javax.swing.JComboBox(); btnNewTax = new javax.swing.JButton(); lDiscountRate = new javax.swing.JLabel(); lDiscountRate.setHorizontalAlignment(SwingConstants.TRAILING); lPercentage = new javax.swing.JLabel(); tfDiscountRate = new DoubleTextField(18); tfDiscountRate.setHorizontalAlignment(SwingConstants.TRAILING); chkVisible = new javax.swing.JCheckBox(); tabModifier = new javax.swing.JPanel(); btnNewModifierGroup = new javax.swing.JButton(); btnDeleteModifierGroup = new javax.swing.JButton(); btnEditModifierGroup = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); tableTicketItemModifierGroups = new javax.swing.JTable(); tabShift = new javax.swing.JPanel(); tabPrice = new javax.swing.JPanel(); tabButtonStyle = new javax.swing.JPanel(); btnDeleteShift = new javax.swing.JButton(); btnAddShift = new javax.swing.JButton(); btnNewPrice = new javax.swing.JButton(); btnUpdatePrice = new javax.swing.JButton(); btnDeletePrice = new javax.swing.JButton(); btnDeleteAll = new javax.swing.JButton(); btnDefaultValue = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); jScrollPane3 = new javax.swing.JScrollPane(); shiftTable = new javax.swing.JTable(); priceTable = new javax.swing.JTable(); cbPrinterGroup = new JComboBox<PrinterGroup>(new DefaultComboBoxModel<PrinterGroup>( PrinterGroupDAO.getInstance().findAll().toArray(new PrinterGroup[0]))); cbPrinterGroup.setPreferredSize(new Dimension(226, 0)); tfTranslatedName = new FixedLengthTextField(20); tfTranslatedName.setLength(120); lblUnitName = new JLabel(Messages.getString("MenuItemForm.23")); //$NON-NLS-1$ lblKitchenPrinter = new JLabel(Messages.getString("MenuItemForm.27")); //$NON-NLS-1$ lgroup.setText(Messages.getString("LABEL_GROUP")); //$NON-NLS-1$ lfname.setText(Messages.getString("LABEL_NAME")); //$NON-NLS-1$ tfName.setLength(120); lblTranslatedName = new JLabel(Messages.getString("MenuItemForm.lblTranslatedName.text")); //$NON-NLS-1$ tfBarcode = new FixedLengthTextField(20); tfSortOrder = new IntegerTextField(20); lblSortOrder = new JLabel(Messages.getString("MenuItemForm.lblSortOrder.text")); //$NON-NLS-1$ tfSortOrder.setText(""); //$NON-NLS-1$ lblBarcode = new JLabel(Messages.getString("MenuItemForm.lblBarcode.text")); //$NON-NLS-1$ cbTax.setPreferredSize(new Dimension(198, 0)); ///lblButtonColor = new JLabel(Messages.getString("MenuItemForm.lblButtonColor.text")); //$NON-NLS-1$ btnButtonColor = new JButton(); //$NON-NLS-1$ btnButtonColor.setPreferredSize(new Dimension(228, 40)); lblTextColor = new JLabel(Messages.getString("MenuItemForm.lblTextColor.text")); //$NON-NLS-1$ btnTextColor = new JButton(Messages.getString("MenuItemForm.SAMPLE_TEXT")); //$NON-NLS-1$ // btnTextColor.setPreferredSize(new Dimension(228, 40)); cbShowTextWithImage = new JCheckBox(Messages.getString("MenuItemForm.40")); //$NON-NLS-1$ cbShowTextWithImage.setActionCommand(Messages.getString("MenuItemForm.41")); //$NON-NLS-1$ lTax.setText(Messages.getString("LABEL_TAX")); //$NON-NLS-1$ btnNewTax.setText("..."); //$NON-NLS-1$ cbFractionalUnit = new JCheckBox(Messages.getString("MenuItemForm.24")); //$NON-NLS-1$ btnNewGroup.setText("..."); //$NON-NLS-1$ btnNewGroup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doCreateNewGroup(evt); } }); if (Application.getInstance().isPriceIncludesTax()) { lblPrice.setText(Messages.getString("LABEL_SALES_PRICE_INCLUDING_TAX")); //$NON-NLS-1$ } else { lblPrice.setText(Messages.getString("LABEL_SALES_PRICE_EXCLUDING_TAX")); //$NON-NLS-1$ } tfPrice.setHorizontalAlignment(javax.swing.JTextField.RIGHT); lTax.setText(Messages.getString("LABEL_TAX")); //$NON-NLS-1$ btnNewTax.setText("..."); //$NON-NLS-1$ btnNewTax.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNewTaxdoCreateNewTax(evt); } }); lDiscountRate.setText(com.floreantpos.POSConstants.DISCOUNT_RATE + ":"); //$NON-NLS-1$ lPercentage.setText("%"); //$NON-NLS-1$ chkVisible.setText(com.floreantpos.POSConstants.VISIBLE); chkVisible.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); chkVisible.setMargin(new java.awt.Insets(0, 0, 0, 0)); tabbedPane.addTab(com.floreantpos.POSConstants.GENERAL, tabGeneral); tabbedPane.setPreferredSize(new Dimension(750, 470)); btnNewModifierGroup.setText(com.floreantpos.POSConstants.ADD); btnNewModifierGroup.setActionCommand("AddModifierGroup"); //$NON-NLS-1$ btnNewModifierGroup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNewModifierGroupActionPerformed(evt); } }); btnDeleteModifierGroup.setText(com.floreantpos.POSConstants.DELETE); btnDeleteModifierGroup.setActionCommand("DeleteModifierGroup"); //$NON-NLS-1$ btnEditModifierGroup.setText(com.floreantpos.POSConstants.EDIT); btnEditModifierGroup.setActionCommand("EditModifierGroup"); //$NON-NLS-1$ menuItemMGListModel = new MenuItemMGListModel(); tableTicketItemModifierGroups.setModel(menuItemMGListModel); btnNewModifierGroup.addActionListener(this); btnEditModifierGroup.addActionListener(this); btnDeleteModifierGroup.addActionListener(this); btnAddShift.addActionListener(this); btnDeleteShift.addActionListener(this); tfDiscountRate.setDocument(new DoubleDocument()); tabGeneral.setLayout(new MigLayout("insets 20", "[][]20px[][]", "[][][][][][][][][][][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ /*JLabel lblImage = new JLabel(Messages.getString("MenuItemForm.28")); //$NON-NLS-1$ lblImage.setHorizontalAlignment(SwingConstants.TRAILING); tabGeneral.add(lblImage, "cell 0 0,right"); //$NON-NLS-1$ lblImagePreview = new JLabel(""); //$NON-NLS-1$ lblImagePreview.setHorizontalAlignment(JLabel.CENTER); lblImagePreview.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); lblImagePreview.setPreferredSize(new Dimension(100, 100)); tabGeneral.add(lblImagePreview, "cell 1 0"); //$NON-NLS-1$ JButton btnSelectImage = new JButton("..."); //$NON-NLS-1$ btnSelectImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSelectImageFile(); } }); tabGeneral.add(btnSelectImage, "cell 1 0"); //$NON-NLS-1$ btnClearImage = new JButton(Messages.getString("MenuItemForm.34")); //$NON-NLS-1$ btnClearImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doClearImage(); } }); tabGeneral.add(btnClearImage, "cell 1 0"); //$NON-NLS-1$ */ tabGeneral.add(lfname, "cell 0 1 ,right"); //$NON-NLS-1$ tabGeneral.add(tfName, "cell 1 1,grow"); //$NON-NLS-1$ tabGeneral.add(lblTranslatedName, "cell 0 2,right"); //$NON-NLS-1$ tabGeneral.add(tfTranslatedName, "cell 1 2,grow"); //$NON-NLS-1$ /*tabGeneral.add(new JLabel("Description"), "cell 0 3,right"); JScrollPane scrlDescription = new JScrollPane(tfDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); tabGeneral.add(scrlDescription, "cell 1 3");*/ tabGeneral.add(lblUnitName, "cell 0 3,right"); //$NON-NLS-1$ tabGeneral.add(tfUnitName, "cell 1 3,grow"); //$NON-NLS-1$ JLabel lblBuyPrice = new JLabel(Messages.getString("LABEL_BUY_PRICE")); //$NON-NLS-1$ tabGeneral.add(lblBuyPrice, "cell 0 4,alignx right"); //$NON-NLS-1$ tfBuyPrice = new DoubleTextField(20); tfBuyPrice.setHorizontalAlignment(SwingConstants.TRAILING); tabGeneral.add(tfBuyPrice, "cell 1 4,grow"); //$NON-NLS-1$ tabGeneral.add(lblPrice, "cell 0 5,alignx right"); //$NON-NLS-1$ tabGeneral.add(tfPrice, "cell 1 5,grow"); //$NON-NLS-1$ tabGeneral.add(lgroup, "cell 0 6,alignx right"); //$NON-NLS-1$ tabGeneral.add(cbGroup, "cell 1 6"); //$NON-NLS-1$ tabGeneral.add(btnNewGroup, "cell 1 6"); //$NON-NLS-1$ tabGeneral.add(lblBarcode, "cell 0 7,alignx right"); //$NON-NLS-1$ tabGeneral.add(tfBarcode, "cell 1 7,grow"); //$NON-NLS-1$ tabGeneral.add(lblSortOrder, "cell 0 8,alignx right"); //$NON-NLS-1$ tabGeneral.add(tfSortOrder, "cell 1 8,grow"); //$NON-NLS-1$ tabGeneral.add(lblStockCount, "cell 0 9,alignx right"); //$NON-NLS-1$ tabGeneral.add(tfStockCount, "cell 1 9,grow"); //$NON-NLS-1$ //tabGeneral.add(cbShowTextWithImage, "cell 1 8"); //$NON-NLS-1$ tabGeneral.add(chkVisible, "cell 1 10"); //$NON-NLS-1$ tabGeneral.add(cbFractionalUnit, "cell 1 11"); //$NON-NLS-1$ tabGeneral.add(cbDisableStockCount, "cell 1 12"); //$NON-NLS-1$ // right side tabGeneral.add(lblKitchenPrinter, "cell 2 1,right"); //$NON-NLS-1$ tabGeneral.add(cbPrinterGroup, "cell 3 1,grow"); //$NON-NLS-1$ tabGeneral.add(lTax, "cell 2 2,right"); //$NON-NLS-1$ tabGeneral.add(cbTax, "cell 3 2"); //$NON-NLS-1$ tabGeneral.add(btnNewTax, "cell 3 2,grow"); //$NON-NLS-1$ /*tabGeneral.add(lblButtonColor, "cell 2 3,right"); //$NON-NLS-1$ tabGeneral.add(btnButtonColor, "cell 3 3,grow"); //$NON-NLS-1$ tabGeneral.add(lblTextColor, "cell 2 4,right"); //$NON-NLS-1$ tabGeneral.add(btnTextColor, "cell 3 4 3 5"); //$NON-NLS-1$ btnTextColor.setPreferredSize(new Dimension(228, 50));*/ tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.25")), "cell 2 3,,aligny top,alignx right"); //$NON-NLS-1$ //$NON-NLS-2$ orderList = new CheckBoxList(); List<OrderType> orderTypes = Application.getInstance().getOrderTypes(); orderList.setModel(orderTypes); // List<String> orderListM = new ArrayList(); // orderListM.add(OrderType.DINE_IN.toString()); // orderListM.add(OrderType.BAR_TAB.toString()); // orderListM.add(OrderType.DRIVE_THRU.toString()); // orderListM.add(OrderType.HOME_DELIVERY.toString()); // orderListM.add(OrderType.PICKUP.toString()); // orderListM.add(OrderType.RETAIL.toString()); // orderListM.add(OrderType.TAKE_OUT.toString()); // orderList.setModel(orderListM); JScrollPane orderCheckBoxList = new JScrollPane(orderList); orderCheckBoxList.setPreferredSize(new Dimension(228, 100)); tabGeneral.add(orderCheckBoxList, "cell 3 3 3 4"); //$NON-NLS-1$ tfDescription.setWrapStyleWord(true); tfDescription.setLineWrap(true); tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.29")), "cell 2 7,aligny top,alignx right"); //$NON-NLS-1$ //$NON-NLS-2$ JScrollPane scrlDescription = new JScrollPane(tfDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrlDescription.setPreferredSize(new Dimension(228, 90)); tabGeneral.add(scrlDescription, "cell 3 7 3 4"); //$NON-NLS-1$ add(tabbedPane); //TODO: addRecepieExtension(); /*btnButtonColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(MenuItemForm.this, Messages.getString("MenuItemForm.42"), btnButtonColor.getBackground()); //$NON-NLS-1$ btnButtonColor.setBackground(color); btnTextColor.setBackground(color); } }); btnTextColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(MenuItemForm.this, Messages.getString("MenuItemForm.43"), btnTextColor.getForeground()); //$NON-NLS-1$ btnTextColor.setForeground(color); } });*/ jScrollPane1.setViewportView(tableTicketItemModifierGroups); GroupLayout jPanel2Layout = new GroupLayout(tabModifier); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap() .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 412, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE) .addComponent(btnDeleteModifierGroup).addComponent(btnEditModifierGroup) .addComponent(btnNewModifierGroup)) .addContainerGap())); jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout .createParallelGroup(Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addComponent(btnNewModifierGroup) .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnEditModifierGroup) .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnDeleteModifierGroup)) .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)) .addContainerGap())); tabModifier.setLayout(jPanel2Layout); tabbedPane.addTab(com.floreantpos.POSConstants.MODIFIER_GROUPS, tabModifier); btnDeleteShift.setText(com.floreantpos.POSConstants.DELETE_SHIFT); btnAddShift.setText(com.floreantpos.POSConstants.ADD_SHIFT); shiftTable .setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ jScrollPane2.setViewportView(shiftTable); org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(tabShift); tabShift.setLayout(jPanel3Layout); jPanel3Layout .setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup().addContainerGap(76, Short.MAX_VALUE) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 670, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createSequentialGroup().add(btnAddShift).add(5, 5, 5) .add(btnDeleteShift))) .addContainerGap())); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup() .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 345, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(btnAddShift).add(btnDeleteShift)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); tabbedPane.addTab(com.floreantpos.POSConstants.SHIFTS, tabShift); // btnNewPrice.setText(Messages.getString("MenuItemForm.9")); //$NON-NLS-1$ btnNewPrice.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addNewPrice(); } }); btnUpdatePrice.setText(Messages.getString("MenuItemForm.13")); //$NON-NLS-1$ btnUpdatePrice.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updatePrice(); } }); btnDeletePrice.setText(Messages.getString("MenuItemForm.14")); //$NON-NLS-1$ btnDeletePrice.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deletePrice(); } }); btnDeleteAll.setText(Messages.getString("MenuItemForm.15")); //$NON-NLS-1$ btnDeleteAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteAll(); } }); btnDefaultValue.setText(Messages.getString("MenuItemForm.7")); //$NON-NLS-1$ /*btnDefaultValue.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setDefaultValue(); } });*/ priceTable .setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ jScrollPane3.setViewportView(priceTable); tabPrice.setLayout(new BorderLayout()); tabPrice.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); tabPrice.add(jScrollPane3, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(); buttonPanel.add(btnNewPrice); buttonPanel.add(btnUpdatePrice); //buttonPanel.add(btnDefaultValue); buttonPanel.add(btnDeletePrice); // buttonPanel.add(btnDeleteAll); tabPrice.add(buttonPanel, BorderLayout.SOUTH); tabbedPane.addTab(Messages.getString("MenuItemForm.16"), tabPrice); //$NON-NLS-1$ // tabbedPane.addChangeListener(this); // tabButtonStyle.setLayout(new MigLayout("insets 10", "[][]100[][][][]", "[][][center][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ JLabel lblImage = new JLabel(Messages.getString("MenuItemForm.28")); //$NON-NLS-1$ lblImage.setHorizontalAlignment(SwingConstants.TRAILING); tabButtonStyle.add(lblImage, "cell 0 0,right"); //$NON-NLS-1$ lblImagePreview = new JLabel(""); //$NON-NLS-1$ lblImagePreview.setHorizontalAlignment(JLabel.CENTER); lblImagePreview.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); lblImagePreview.setPreferredSize(new Dimension(100, 100)); tabButtonStyle.add(lblImagePreview, "cell 1 0"); //$NON-NLS-1$ JButton btnSelectImage = new JButton("..."); //$NON-NLS-1$ btnClearImage = new JButton(Messages.getString("MenuItemForm.34")); //$NON-NLS-1$ tabButtonStyle.add(btnClearImage, "cell 1 0"); //$NON-NLS-1$ tabButtonStyle.add(btnSelectImage, "cell 1 0"); //$NON-NLS-1$ tabButtonStyle.add(lblButtonColor, "cell 0 2,right"); //$NON-NLS-1$ tabButtonStyle.add(btnButtonColor, "cell 1 2,grow"); //$NON-NLS-1$ tabButtonStyle.add(lblTextColor, "cell 0 3,right"); //$NON-NLS-1$ tabButtonStyle.add(btnTextColor, "cell 1 3"); //$NON-NLS-1$ tabButtonStyle.add(cbShowTextWithImage, "cell 1 4"); //$NON-NLS-1$ /* tabButtonStyle.add(lblImagePreview, "cell 3 0 3 4"); //$NON-NLS-1$ tabButtonStyle.add(btnClearImage, "cell 3 0,gaptop 40"); //$NON-NLS-1$ tabButtonStyle.add(btnSelectImage, "cell 3 0,gaptop 40"); //$NON-NLS-1$ tabButtonStyle.add(lblImage, "cell 2 0,gaptop 40"); //$NON-NLS-1$ tabButtonStyle.add(lblButtonColor, "cell 0 0,right"); //$NON-NLS-1$ tabButtonStyle.add(btnButtonColor, "cell 1 0,grow"); //$NON-NLS-1$ tabButtonStyle.add(lblTextColor, "cell 0 1,right"); //$NON-NLS-1$ tabButtonStyle.add(btnTextColor, "cell 1 1"); //$NON-NLS-1$ */ btnTextColor.setPreferredSize(new Dimension(228, 50)); btnSelectImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSelectImageFile(); } }); btnClearImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doClearImage(); } }); btnButtonColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(MenuItemForm.this, Messages.getString("MenuItemForm.42"), //$NON-NLS-1$ btnButtonColor.getBackground()); btnButtonColor.setBackground(color); btnTextColor.setBackground(color); } }); btnTextColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(MenuItemForm.this, Messages.getString("MenuItemForm.43"), //$NON-NLS-1$ btnTextColor.getForeground()); btnTextColor.setForeground(color); } }); tabbedPane.addTab(Messages.getString("MenuItemForm.26"), tabButtonStyle); //$NON-NLS-1$ }
From source file:techtonic.Techtonic.java
private void bgColorLabMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bgColorLabMouseClicked Color c = JColorChooser.showDialog(null, "Choose a Background Color", null); bgPan.setBackground(c);//from w w w . j a v a 2 s .c om bgColor = c; }