private JPanel createGraphSelectionSubPane() { Font font = new Font("SansSerif", Font.PLAIN, 10); // Search field JPanel searchPanel = new JPanel(); searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.X_AXIS)); searchPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0)); searchPanel.add(columnSelection); columnMatchLabel.setEnabled(false); applyFilterBtn.setEnabled(false); caseChkBox.setEnabled(false); regexpChkBox.setEnabled(false); columnSelection.addActionListener(this); searchPanel.add(columnMatchLabel); searchPanel.add(Box.createRigidArea(new Dimension(5, 0))); // Button applyFilterBtn.setFont(font); applyFilterBtn.addActionListener(this); searchPanel.add(applyFilterBtn); // checkboxes caseChkBox.setFont(font); searchPanel.add(caseChkBox); regexpChkBox.setFont(font); searchPanel.add(regexpChkBox); return searchPanel; }
private void setAllFonts() { Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 12); Font fontBold = new Font(Font.SANS_SERIF, Font.BOLD, 12); Font fontSmallItalic = new Font(Font.SANS_SERIF, Font.ITALIC, 10); lb_smtp.setFont(fontBold); tf_smtp.setFont(font); lb_smtpUser.setFont(fontBold); tf_smtpUser.setFont(font); lb_smtpPW.setFont(fontBold); pf_smtpPW.setFont(font); lb_from.setFont(fontBold); tf_from.setFont(font); lb_to.setFont(fontBold); tf_to.setFont(font); lb_cc.setFont(fontBold); tf_cc.setFont(font); lb_bcc.setFont(fontBold); tf_bcc.setFont(font); lb_subject.setFont(fontBold); tf_subject.setFont(font); ta_text.setFont(font); cb_attachXml.setFont(fontBold); cb_attachGif.setFont(fontBold); cb_attachPdf.setFont(fontBold); lnk_smtpInfo.setFont(fontSmallItalic); cb_smtp_auth.setFont(fontSmallItalic); cb_pwSave.setFont(fontSmallItalic); }
public MyJObject(int i) { CourseCheckBox = new JCheckBox(DataTransfer.Courses.elementAt(i)); CourseCheckBox.setForeground(Color.WHITE); CourseCheckBox.setFont(new Font("SERRIF", Font.BOLD + Font.ITALIC, 13)); CourseCheckBox.setHorizontalAlignment(SwingConstants.LEFT); CourseCheckBox.setOpaque(false); CourseCheckBox.setSelected(true); TotalMarks = new JLabel( Float.toString( Float.valueOf( TwoDecimal.format(Float.parseFloat(DataTransfer.Total.elementAt(i))))), SwingConstants.CENTER); TotalMarks.setForeground(Color.WHITE); TotalMarks.setFont(new Font("SERRIF", Font.BOLD + Font.ITALIC, 13)); GradePoint = new JLabel(DataTransfer.GradePoint.elementAt(i), SwingConstants.LEFT); GradePoint.setForeground(Color.WHITE); GradePoint.setFont(new Font("SERRIF", Font.ITALIC, 13)); LetterGrade = new JLabel(DataTransfer.LetterGrade.elementAt(i), SwingConstants.LEFT); LetterGrade.setForeground(Color.WHITE); LetterGrade.setFont(new Font("SERRIF", Font.PLAIN, 13)); CreditLabel = new JLabel(Credit.elementAt(i), SwingConstants.LEFT); CreditLabel.setForeground(Color.WHITE); CreditLabel.setFont(new Font("SERRIF", Font.PLAIN, 13)); ExamTypeLabel = new JLabel(DataTransfer.ExamType.elementAt(i), SwingConstants.LEFT); ExamTypeLabel.setForeground(Color.WHITE); ExamTypeLabel.setFont(new Font("SERRIF", Font.PLAIN, 12)); }
private JPanel getClickableTagsPanel() { JPanel pnl = new JPanel(); pnl.setLayout(new GridLayout(0, 3)); ArrayList<Commontags> listTags = new ArrayList<>(mapAllTags.values()); Collections.sort(listTags); for (final Commontags ctag : listTags) { JCheckBox cb = new JCheckBox(ctag.getText()); cb.setForeground(GUITools.getColor(ctag.getColor())); cb.setFont(ctag.getType() == 0 ? SYSConst.ARIAL12 : SYSConst.ARIAL12BOLD); cb.setSelected(listSelectedTags.contains(ctag)); cb.addItemListener( e -> { if (e.getStateChange() == ItemEvent.SELECTED) { listSelectedTags.add(ctag); add(createButton(ctag)); } else { listSelectedTags.remove(ctag); mapButtons.remove(ctag); } notifyListeners(ctag); }); pnl.add(cb); } return pnl; }
public HeaderRenderer2(JTableHeader header, final int index) { // index is the column to be modified check.setOpaque(false); check.setFont(header.getFont()); header.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { JTable table = ((JTableHeader) e.getSource()).getTable(); TableColumnModel columnModel = table.getColumnModel(); int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int modelColumn = table.convertColumnIndexToModel(viewColumn); if (modelColumn == index) { check.setSelected(!check.isSelected()); TableModel m = table.getModel(); Boolean f = check.isSelected(); for (int i = 0; i < m.getRowCount(); i++) { m.setValueAt(f, i, index); } ((JTableHeader) e.getSource()).repaint(); } else { return; } } }); }
private void newComps() { ta = new JTextArea(); // ta.setLineWrap(true); ta.setWrapStyleWord(true); ta.setFocusable(false); ta.setEditable(false); ta.setFont(new Font("Courier New", Font.BOLD, 20)); ta.setBackground(Color.black); ta.setForeground(Color.GREEN); sc = new JScrollPane(); sc.setViewportView(ta); btnExport = new JButton("Export"); btnExport.setOpaque(false); btnExport.setFont(ta.getFont()); btnExport.setFocusable(false); ckWrap = new JCheckBox("Wrap text"); ckWrap.setOpaque(false); ckWrap.setForeground(Color.white); ckWrap.setFont(ta.getFont()); ckWrap.setFocusable(false); chooser = new JFileChooser(); }
private JCheckBox createCheckBox(String s, boolean b, int y) { JCheckBox cb = new JCheckBox(s, b); cb.setFont(font); cb.setHorizontalAlignment(JCheckBox.LEFT); cb.addItemListener(this); Java2Demo.addToGridBag(this, cb, 0, y, 1, 1, 1.0, 1.0); return cb; }
/** Configures a checkbox with the properties of tree cell renderes. */ private static JCheckBox configureCheckBox(JCheckBox checkBox) { checkBox.setHorizontalAlignment(JCheckBox.LEFT); checkBox.setFont(UIManager.getFont("Tree.font")); checkBox.setBorderPainted(false); checkBox.setFocusPainted(false); checkBox.setFocusable(false); checkBox.setOpaque(false); return checkBox; }
public void setJCheckbox(JCheckBox jcb) { jcb.setOpaque(false); jcb.setBorder(null); jcb.setBorderPainted(false); jcb.setMargin(new Insets(0, 0, 0, 0)); jcb.setContentAreaFilled(false); jcb.setFocusable(false); jcb.setFont(new Font("ËÎÌå", 0, 12)); jcb.addMouseListener(new ButtonListener()); }
/** * <i>Description:</i> * * <p>see <a href=https://en.wikipedia.org/wiki/Hostname>https://en.wikipedia.org * /wiki/Hostname</a> for valid hostname * * @return */ @SuppressWarnings("unchecked") protected JPanel getHostEntryPanel() { if (pnlHostEntry == null) { pnlHostEntry = new JPanel(new BorderLayout(5, 5)); pnlHostEntry.setOpaque(false); JPanel panel = new JPanel(new GridLayout(1, 2, 10, 5)); panel.setOpaque(false); String hostNameChars = UIConstants.DIGITS + UIConstants.LETTERS + "-."; txtFldHostName = new SafeTextField(false, 253); ((SafeTextField) txtFldHostName).setValidChars(hostNameChars); for (DocumentListener listener : hostInfoListener.getDocumentListeners()) { txtFldHostName.getDocument().addDocumentListener(listener); } FieldPair<JFormattedTextField> fp = new FieldPair<JFormattedTextField>(STLConstants.K0051_HOST.getValue(), txtFldHostName); panel.add(fp); txtFldPortNum = new SafeNumberField<Integer>(new DecimalFormat("###"), 0, false, 65535, false); // only positive integer ((SafeNumberField<Integer>) txtFldPortNum).setValidChars(UIConstants.DIGITS); for (DocumentListener listener : hostInfoListener.getDocumentListeners()) { txtFldPortNum.getDocument().addDocumentListener(listener); } txtFldPortNum.setText(STLConstants.K3015_DEFAULT_PORT.getValue()); fp = new FieldPair<JFormattedTextField>( STLConstants.K1035_CONFIGURATION_PORT.getValue(), txtFldPortNum); panel.add(fp); pnlHostEntry.add(panel, BorderLayout.CENTER); chkboxSecureConnect = ComponentFactory.getIntelCheckBox(STLConstants.K2003_SECURE_CONNECT.getValue()); chkboxSecureConnect.setFont(UIConstants.H5_FONT.deriveFont(Font.BOLD)); chkboxSecureConnect.setForeground(UIConstants.INTEL_DARK_GRAY); chkboxSecureConnect.setHorizontalAlignment(JLabel.TRAILING); chkboxSecureConnect.setSelected(false); chkboxSecureConnect.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { hostInfoListener.setDirty(); boolean isSecureConnect = chkboxSecureConnect.isSelected(); enableCerts(isSecureConnect); } }); pnlHostEntry.add(chkboxSecureConnect, BorderLayout.EAST); } return pnlHostEntry; }
@Override public Component getComponent( JTree tree, Object nodeRenderer, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { JCheckBox checkbox = new JCheckBox(this.toString(), this.isChecked); checkbox.setFont( checkbox.getFont().deriveFont(Font.PLAIN | Font.ITALIC, checkbox.getFont().getSize())); checkbox.setBackground(Color.WHITE); return checkbox; }
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JCheckBox checkbox = (JCheckBox) value; if (!UIUtil.isUnderNimbusLookAndFeel()) { checkbox.setBackground(getBackground(isSelected, checkbox)); checkbox.setForeground(getForeground(isSelected, checkbox)); } checkbox.setEnabled(isEnabled()); checkbox.setFont(getFont(checkbox)); checkbox.setFocusPainted(false); checkbox.setBorderPainted(true); checkbox.setBorder(isSelected ? mySelectedBorder : myBorder); adjustRendering(checkbox, isSelected, cellHasFocus); return checkbox; }
/** * Soll Kommentar im Song angezeigt werden * * @return */ private JCheckBox getJCheckBoxAnzeige() { if (jCheckBoxAnzeige == null) { jCheckBoxAnzeige = new JCheckBox(); jCheckBoxAnzeige.setBounds(17, 62, 180, 15); jCheckBoxAnzeige.setText("Anzeige des Kommentares"); jCheckBoxAnzeige.setFont(getFontA()); jCheckBoxAnzeige.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { onCheckBoxAnzeige(); } }); } return jCheckBoxAnzeige; }
private Component getCell( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { checkBox.setSelected(((Boolean) value).booleanValue()); checkBox.setFont(table.getFont()); if (isSelected) { checkBox.setBackground(table.getSelectionBackground()); checkBox.setForeground(table.getSelectionForeground()); } else { checkBox.setBackground(table.getBackground()); checkBox.setForeground(table.getForeground()); } checkBox.setBorder( (hasFocus) ? UIManager.getBorder("Table.focusCellHighlightBorder") : noFocusBorder); return checkBox; }
public Component getListCellRendererComponent( JList<? extends JCheckBox> list, JCheckBox value, int index, boolean isSelected, boolean cellHasFocus) { JCheckBox checkbox = value; // Drawing checkbox, change the appearance here checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground()); checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground()); checkbox.setEnabled(isEnabled()); checkbox.setFont(getFont()); checkbox.setFocusPainted(false); checkbox.setBorderPainted(true); checkbox.setBorder( isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder); return checkbox; }
public MemoryMonitor() { setLayout(new BorderLayout()); setBorder(new TitledBorder(new EtchedBorder(), "Memory Monitor")); add(surf = new Surface()); controls = new JPanel(); controls.setPreferredSize(new Dimension(135, 80)); Font font = new Font("serif", Font.PLAIN, 10); JLabel label = new JLabel("Sample Rate"); label.setFont(font); label.setForeground(Color.red); controls.add(label); tf = new JTextField("1000"); tf.setPreferredSize(new Dimension(45, 20)); controls.add(tf); controls.add(label = new JLabel("ms")); label.setFont(font); label.setForeground(Color.red); controls.add(dateStampCB); dateStampCB.setFont(font); addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { removeAll(); if ((doControls = !doControls)) { surf.stop(); add(controls); } else { try { surf.sleepAmount = Long.parseLong(tf.getText().trim()); } catch (Exception ex) { } surf.start(); add(surf); } validate(); repaint(); } }); }
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (containerBox == null) { containerBox = Box.createHorizontalBox(); checkBox = new JCheckBox(); checkBox.setEnabled(isEnabled()); checkBox.setFont(getFont()); checkBox.setFocusPainted(false); checkBox.setBorderPainted(true); checkBox.setBorder( isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder); containerBox.add(checkBox); } checkBox.setBackground(isSelected ? getSelectionBackground() : getBackground()); checkBox.setForeground(isSelected ? getSelectionForeground() : getForeground()); if (value != null) { ListItem item = (ListItem) value; checkBox.setText(item.dataItem.toString()); checkBox.setSelected(item.selected); } return containerBox; }
public IECheckBoxWidgetView( IEController ieController, IECheckBoxWidget model, boolean addDnDSupport, IEWOComponentView view) { super(ieController, model, addDnDSupport, view); FlowLayout layout = new FlowLayout(FlowLayout.LEFT, 0, 0); setLayout(layout); _jCheckBox = new JCheckBox(); _jCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { isUpdatingModel = true; getCheckBoxModel().setValue(((JCheckBox) e.getSource()).isSelected()); isUpdatingModel = false; } }); _jCheckBox.setFont(TEXTFIELD_FONT); container = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 4)); container.setOpaque(false); container.add(_jCheckBox); add(container); _jCheckBox.setEnabled(true); _jCheckBox.setFocusable(false); _jCheckBox.setOpaque(false); if (getCheckBoxModel().getDescription() != null) { _jCheckBox.setToolTipText(getCheckBoxModel().getDescription()); } TransparentMouseListener tml = new TransparentMouseListener(_jCheckBox, this); _jCheckBox.addMouseListener(tml); _jCheckBox.addMouseMotionListener(tml); _jCheckBox.setSelected(getCheckBoxModel().getValue()); _jCheckBox.setBackground(getBackgroundColor()); setBackground(getBackgroundColor()); revalidate(); }
/** * Set up the expander button to display qualifier values. * * @param butt - expander button * @param qualifier - the qualifer that is being displayed * @param qualifierValueBox - Box containing the values * @param qualifierNameCheckBox - JCheckBox for the given qualifier * @param pane * @return */ private Vector<JCheckBox> setExpanderButton( final JButton butt, final Qualifier qualifier, final Box qualifierValueBox, final JCheckBox qualifierNameCheckBox) { butt.setMargin(new Insets(0, 0, 0, 0)); butt.setHorizontalAlignment(SwingConstants.RIGHT); butt.setHorizontalTextPosition(SwingConstants.RIGHT); butt.setBorderPainted(false); butt.setFont(butt.getFont().deriveFont(Font.BOLD)); butt.setForeground(TransferAnnotationTool.STEEL_BLUE); butt.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (butt.getText().equals("+")) butt.setText("-"); else butt.setText("+"); qualifierValueBox.setVisible(butt.getText().equals("-")); revalidate(); } }); // set-up qualifier values list qualifierValueBox.setVisible(false); final Vector<JCheckBox> qualifierValuesCheckBox = new Vector<JCheckBox>(); final StringVector values = qualifier.getValues(); if (values != null) { for (int i = 0; i < values.size(); i++) { final JCheckBox cb = new JCheckBox(values.get(i), qualifierNameCheckBox.isSelected()); cb.setFont(cb.getFont().deriveFont(Font.ITALIC)); qualifierValueBox.add(cb); qualifierValuesCheckBox.add(cb); } } return qualifierValuesCheckBox; }
@Override public Void doInBackground() throws Exception { StringBuilder message = new StringBuilder(); try { getManager().deleteBean(t, "CanDelete"); // IN18N } catch (PropertyVetoException e) { if (e.getPropertyChangeEvent().getPropertyName().equals("DoNotDelete")) { // IN18N log.warn(e.getMessage()); message.append( Bundle.getMessage( "VetoDeleteBean", t.getBeanType(), t.getFullyFormattedDisplayName(), e.getMessage())); JOptionPane.showMessageDialog( null, message.toString(), Bundle.getMessage("WarningTitle"), JOptionPane.ERROR_MESSAGE); return null; } message.append(e.getMessage()); } int count = t.getNumPropertyChangeListeners(); if (log.isDebugEnabled()) { log.debug("Delete with " + count); } if (getDisplayDeleteMsg() == 0x02 && message.toString().equals("")) { doDelete(t); } else { final JDialog dialog = new JDialog(); dialog.setTitle(Bundle.getMessage("WarningTitle")); dialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel container = new JPanel(); container.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS)); if (count > 0) { // warn of listeners attached before delete JLabel question = new JLabel(Bundle.getMessage("DeletePrompt", t.getFullyFormattedDisplayName())); question.setAlignmentX(Component.CENTER_ALIGNMENT); container.add(question); ArrayList<String> listenerRefs = t.getListenerRefs(); if (listenerRefs.size() > 0) { ArrayList<String> listeners = new ArrayList<>(); for (int i = 0; i < listenerRefs.size(); i++) { if (!listeners.contains(listenerRefs.get(i))) { listeners.add(listenerRefs.get(i)); } } message.append("<br>"); message.append(Bundle.getMessage("ReminderInUse", count)); message.append("<ul>"); for (int i = 0; i < listeners.size(); i++) { message.append("<li>"); message.append(listeners.get(i)); message.append("</li>"); } message.append("</ul>"); JEditorPane pane = new JEditorPane(); pane.setContentType("text/html"); pane.setText("<html>" + message.toString() + "</html>"); pane.setEditable(false); JScrollPane jScrollPane = new JScrollPane(pane); container.add(jScrollPane); } } else { String msg = MessageFormat.format( Bundle.getMessage("DeletePrompt"), new Object[] {t.getSystemName()}); JLabel question = new JLabel(msg); question.setAlignmentX(Component.CENTER_ALIGNMENT); container.add(question); } final JCheckBox remember = new JCheckBox(Bundle.getMessage("MessageRememberSetting")); remember.setFont(remember.getFont().deriveFont(10f)); remember.setAlignmentX(Component.CENTER_ALIGNMENT); JButton yesButton = new JButton(Bundle.getMessage("ButtonYes")); JButton noButton = new JButton(Bundle.getMessage("ButtonNo")); JPanel button = new JPanel(); button.setAlignmentX(Component.CENTER_ALIGNMENT); button.add(yesButton); button.add(noButton); container.add(button); noButton.addActionListener( (ActionEvent e) -> { // there is no point in remembering this the user will never be // able to delete a bean! dialog.dispose(); }); yesButton.addActionListener( (ActionEvent e) -> { if (remember.isSelected()) { setDisplayDeleteMsg(0x02); } doDelete(t); dialog.dispose(); }); container.add(remember); container.setAlignmentX(Component.CENTER_ALIGNMENT); container.setAlignmentY(Component.CENTER_ALIGNMENT); dialog.getContentPane().add(container); dialog.pack(); dialog.setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width) / 2 - dialog.getWidth() / 2, (Toolkit.getDefaultToolkit().getScreenSize().height) / 2 - dialog.getHeight() / 2); dialog.setModal(true); dialog.setVisible(true); } return null; }
/** * Initializes the GUI by creating the components, placing them in the dialog, and displaying * them. */ private void init() { setForeground(Color.black); setTitle("Nonlocal Means Filter"); JPanel mainPanel; mainPanel = new JPanel(); mainPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); mainPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 1; gbc.gridheight = 1; gbc.anchor = GridBagConstraints.WEST; gbc.weightx = 1; gbc.insets = new Insets(3, 3, 3, 3); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.HORIZONTAL; paramPanel = new JPanel(new GridBagLayout()); paramPanel.setForeground(Color.black); paramPanel.setBorder(buildTitledBorder("Parameters")); mainPanel.add(paramPanel, gbc); GridBagConstraints gbc2 = new GridBagConstraints(); gbc2.gridwidth = 1; gbc2.gridheight = 1; gbc2.anchor = GridBagConstraints.WEST; gbc2.weightx = 1; gbc2.insets = new Insets(3, 3, 3, 3); gbc2.gridx = 0; gbc2.gridy = 0; gbc2.fill = GridBagConstraints.HORIZONTAL; labelSearchWindowSide = createLabel("Search window side (odd)"); paramPanel.add(labelSearchWindowSide, gbc2); gbc2.gridx = 1; textSearchWindowSide = createTextField("15"); paramPanel.add(textSearchWindowSide, gbc2); gbc2.gridx = 0; gbc2.gridy = 1; labelSimilarityWindowSide = createLabel("Similarity window side (odd) "); paramPanel.add(labelSimilarityWindowSide, gbc2); gbc2.gridx = 1; textSimilarityWindowSide = createTextField("7"); paramPanel.add(textSimilarityWindowSide, gbc2); gbc2.gridx = 0; gbc2.gridy = 2; labelNoiseStandardDeviation = createLabel("Noise standard deviation "); paramPanel.add(labelNoiseStandardDeviation, gbc2); gbc2.gridx = 1; textNoiseStandardDeviation = createTextField("10.0"); paramPanel.add(textNoiseStandardDeviation, gbc2); gbc2.gridx = 0; gbc2.gridy = 3; labelDegree = createLabel("Degree of filtering "); labelDegree.setEnabled(doRician); paramPanel.add(labelDegree, gbc2); gbc2.gridx = 1; textDegree = createTextField("1.414"); textDegree.setEnabled(doRician); paramPanel.add(textDegree, gbc2); gbc2.gridx = 0; gbc2.gridy = 4; doRicianCheckBox = new JCheckBox("Deal with Rician noise in MRI"); doRicianCheckBox.setFont(serif12); doRicianCheckBox.setSelected(false); doRicianCheckBox.addActionListener(this); paramPanel.add(doRicianCheckBox, gbc2); if (image.getNDims() > 2) { gbc2.gridx = 0; gbc2.gridy = 5; gbc2.gridwidth = 2; image25DCheckBox = new JCheckBox("Process each slice independently (2.5D)"); image25DCheckBox.setFont(serif12); paramPanel.add(image25DCheckBox, gbc2); image25DCheckBox.setSelected(false); } // if (image.getNDims > 2) JPanel outputOptPanel = new JPanel(new GridLayout(1, 2)); destinationPanel = new JPanel(new BorderLayout()); destinationPanel.setForeground(Color.black); destinationPanel.setBorder(buildTitledBorder("Destination")); outputOptPanel.add(destinationPanel); destinationGroup = new ButtonGroup(); newImage = new JRadioButton("New image", true); newImage.setBounds(10, 16, 120, 25); newImage.setFont(serif12); destinationGroup.add(newImage); destinationPanel.add(newImage, BorderLayout.NORTH); replaceImage = new JRadioButton("Replace image", false); replaceImage.setFont(serif12); destinationGroup.add(replaceImage); destinationPanel.add(replaceImage, BorderLayout.CENTER); // Only if the image is unlocked can it be replaced. if (image.getLockStatus() == ModelStorageBase.UNLOCKED) { replaceImage.setEnabled(true); } else { replaceImage.setEnabled(false); } gbc.gridx = 0; gbc.gridy = 1; mainPanel.add(outputOptPanel, gbc); mainDialogPanel.add(mainPanel, BorderLayout.CENTER); mainDialogPanel.add(buildButtons(), BorderLayout.SOUTH); getContentPane().add(mainDialogPanel); pack(); setResizable(true); // setVisible(true); System.gc(); }
public void content() { Font font00 = new Font("宋体", Font.BOLD, 20); Font font0 = new Font("宋体", Font.BOLD, 16); Font font = new Font("宋体", Font.BOLD, 15); line1 = new JLabel("————————————————————————"); line1.setFont(font0); line1.setBounds( listpanel.getX() - panel.getWidth() / 15, listpanel.getY() - panel.getHeight() / 20, panel.getWidth() * 3 / 5, panel.getHeight() / 10); line2 = new JLabel("——————————————————————"); line2.setFont(font0); line2.setForeground(Color.GRAY); line2.setBounds( listpanel.getX() - panel.getWidth() / 30, listpanel.getY() + panel.getHeight() / 36, panel.getWidth() * 3 / 5, panel.getHeight() / 10); line3 = new JLabel("——————————————————————"); line3.setFont(font0); line3.setForeground(Color.GRAY); line3.setBounds( listpanel.getX() - panel.getWidth() / 30, listpanel.getY() + panel.getHeight() / 100 * 75, panel.getWidth() * 3 / 5, panel.getHeight() / 10); ok = new JButton("提交"); ok.setFont(font); ok.setBounds( listpanel.getX() + panel.getWidth() * 2 / 5, listpanel.getY() + panel.getHeight() * 30 / 40, panel.getWidth() / 10, panel.getHeight() / 20); cancel = new JButton("取消"); cancel.setFont(font); cancel.setBounds( ok.getX() - panel.getWidth() / 7, ok.getY(), panel.getWidth() / 10, panel.getHeight() / 20); outList = new JLabel("出库单"); outList.setFont(font00); outList.setBounds( listpanel.getX() - panel.getWidth() / 15, listpanel.getY() - panel.getHeight() / 13, panel.getWidth() / 10, panel.getHeight() / 10); cargoinfo = new JLabel("货物信息"); cargoinfo.setFont(font0); cargoinfo.setBounds( listpanel.getX() - panel.getWidth() / 30, listpanel.getY(), panel.getWidth() / 10, panel.getHeight() / 10); bar = new JLabel("订单号"); bar.setFont(font); bar.setBounds( cargoinfo.getX(), cargoinfo.getY() + panel.getHeight() / 13, panel.getWidth() / 5, panel.getHeight() / 10); /* code=new JLabel("出库单号:"); code.setFont(font); code.setBounds(cargoinfo.getX(),bar.getY()+panel.getHeight()/13,panel.getWidth()/5, panel.getHeight()/10); */ outDate = new JLabel("出库日期:"); outDate.setFont(font); outDate.setBounds( cargoinfo.getX(), bar.getY() + panel.getHeight() / 14, panel.getWidth() / 5, panel.getHeight() / 10); distination = new JLabel("目的地:"); distination.setFont(font); distination.setBounds( cargoinfo.getX(), outDate.getY() + panel.getHeight() / 13, panel.getWidth() / 5, panel.getHeight() / 10); damageCondition = new JLabel("损坏情况"); damageCondition.setFont(font); damageCondition.setBounds( cargoinfo.getX(), distination.getY() + panel.getHeight() / 13, panel.getWidth() / 5, panel.getHeight() / 10); good = new JCheckBox("完好"); good.setFont(font); good.setBounds( damageCondition.getX() + panel.getWidth() / 8, damageCondition.getY() + panel.getHeight() / 45, panel.getWidth() / 12, panel.getHeight() / 20); damage = new JCheckBox("损坏"); damage.setFont(font); damage.setBounds( good.getX() + panel.getWidth() / 8, damageCondition.getY() + panel.getHeight() / 45, panel.getWidth() / 12, panel.getHeight() / 20); loadingtype = new JLabel("装运形式:"); loadingtype.setFont(font); loadingtype.setBounds( damageCondition.getX(), damageCondition.getY() + panel.getHeight() / 13, panel.getWidth() / 5, panel.getHeight() / 10); tB = new JCheckBox("火车"); tB.setFont(font); tB.setBounds( loadingtype.getX() + panel.getWidth() / 8, loadingtype.getY() + panel.getHeight() / 45, panel.getWidth() / 12, panel.getHeight() / 20); pB = new JCheckBox("飞机"); pB.setFont(font); pB.setBounds( tB.getX() + panel.getWidth() / 8, loadingtype.getY() + panel.getHeight() / 45, panel.getWidth() / 12, panel.getHeight() / 20); bB = new JCheckBox("汽车"); bB.setFont(font); bB.setBounds( pB.getX() + panel.getWidth() / 8, loadingtype.getY() + panel.getHeight() / 45, panel.getWidth() / 12, panel.getHeight() / 20); // transfercode=new JLabel("中转单编号:"); // transfercode.setFont(font); // transfercode.setBounds(cargoinfo.getX(),bB.getY()+panel.getHeight()/14,panel.getWidth()/5, // panel.getHeight()/10); // codetext = new JTextField(); // codetext.setBounds(code.getX()+panel.getWidth()/8,code.getY()+panel.getWidth()/50,panel.getWidth()/6, panel.getHeight()/20); /* tip1 = new JLabel("*请输入10位有效出库单号"); tip1.setFont(new Font("宋体", Font.BOLD, 12)); tip1.setForeground(Color.GRAY); tip1.setBounds(codetext.getX()+codetext.getWidth()+panel.getWidth()/50,code.getY(),panel.getWidth()/3, panel.getHeight()/10); */ vehicleCode = new JLabel("汽运编号:"); vehicleCode.setFont(font); vehicleCode.setBounds( cargoinfo.getX(), bB.getY() + panel.getHeight() / 14, panel.getWidth() / 5, panel.getHeight() / 10); bartext = new JTextField(); bartext.setBounds( bar.getX() + panel.getWidth() / 8, bar.getY() + panel.getWidth() / 50, panel.getWidth() / 6, panel.getHeight() / 20); distext = new JTextField(); distext.setBounds( distination.getX() + panel.getWidth() / 8, distination.getY() + panel.getWidth() / 50, panel.getWidth() / 6, panel.getHeight() / 20); // transtext = new JTextField(); // transtext.setBounds(transfercode.getX()+panel.getWidth()/7,transfercode.getY()+panel.getWidth()/50,panel.getWidth()/6, panel.getHeight()/20); vehtext = new JTextField(); vehtext.setBounds( distination.getX() + panel.getWidth() / 7, vehicleCode.getY() + panel.getWidth() / 50, panel.getWidth() / 6, panel.getHeight() / 20); /* tip2 = new JLabel("*请输入14位有效中转单编号"); tip2.setFont(new Font("宋体", Font.BOLD, 12)); tip2.setForeground(Color.GRAY); tip2.setBounds(transtext.getX()+transtext.getWidth()+panel.getWidth()/50,transfercode.getY(),panel.getWidth()/3, panel.getHeight()/10); */ year = new JComboBox(); month = new JComboBox(); day = new JComboBox(); String[] arr1 = new String[1000]; // 数组时个对象,对象在使用前要初始化 for (int i = 0; i < 1000; i++) { arr1[i] = i + 2000 + "年"; } year = new JComboBox(arr1); Calendar calendar = Calendar.getInstance(); String y = String.valueOf(calendar.get(Calendar.YEAR)) + "年"; for (String y1 : arr1) { if (y1.equals(y)) { year.setSelectedItem(y); } } year.setBounds( outDate.getX() + panel.getWidth() / 8, outDate.getY() + panel.getWidth() / 50, panel.getWidth() / 11, panel.getHeight() / 20); String[] arr2 = new String[12]; for (int i = 0; i < 12; i++) { arr2[i] = i + 1 + "月"; } month = new JComboBox(arr2); String m = String.valueOf(calendar.get(Calendar.MONTH) + 1) + "月"; for (String m1 : arr2) { if (m1.equals(m)) { month.setSelectedItem(m1); } } month.setBounds( year.getX() + year.getWidth() + panel.getWidth() / 100, outDate.getY() + panel.getWidth() / 50, panel.getWidth() / 12, panel.getHeight() / 20); String[] arr30 = new String[31]; for (int i = 0; i < 31; i++) { arr30[i] = i + 1 + "日"; } day = new JComboBox(arr30); String d = String.valueOf(calendar.get(Calendar.DATE)) + "日"; for (String d1 : arr30) { if (d1.equals(d)) { day.setSelectedItem(d1); } } day.setBounds( month.getX() + month.getWidth() + panel.getWidth() / 100, outDate.getY() + panel.getWidth() / 50, panel.getWidth() / 12, panel.getHeight() / 20); listpanel.add(day); month.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent arg0) { // TODO Auto-generated method stub listpanel.remove(day); switch (month.getSelectedItem().toString()) { case "1月": case "3月": case "5月": case "7月": case "8月": case "10月": case "12月": String[] arr31 = new String[31]; for (int i = 0; i < 31; i++) { arr31[i] = i + 1 + "日"; } day = new JComboBox(arr31); day.setBounds( month.getX() + month.getWidth() + panel.getWidth() / 100, outDate.getY() + panel.getWidth() / 50, panel.getWidth() / 12, panel.getHeight() / 20); listpanel.add(day); break; case "4月": case "6月": case "9月": case "11月": String[] arr3 = new String[30]; for (int i = 0; i < 30; i++) { arr3[i] = i + 1 + "日"; } day = new JComboBox(arr3); day.setBounds( month.getX() + month.getWidth() + panel.getWidth() / 100, outDate.getY() + panel.getWidth() / 50, panel.getWidth() / 12, panel.getHeight() / 20); listpanel.add(day); break; case "2月": if (isLeap(year.getSelectedItem().toString())) { String[] arr33 = new String[29]; for (int i = 0; i < 29; i++) { arr33[i] = i + 1 + "日"; } day = new JComboBox(arr33); day.setBounds( month.getX() + month.getWidth() + panel.getWidth() / 100, outDate.getY() + panel.getWidth() / 50, panel.getWidth() / 12, panel.getHeight() / 20); listpanel.add(day); } else { String[] arr333 = new String[28]; for (int i = 0; i < 28; i++) { arr333[i] = i + 1 + "日"; } day = new JComboBox(arr333); day.setBounds( month.getX() + month.getWidth() + panel.getWidth() / 100, outDate.getY() + panel.getWidth() / 50, panel.getWidth() / 12, panel.getHeight() / 20); listpanel.add(day); } break; default: break; } } }); listpanel.add(year); listpanel.add(month); listpanel.add(day); listpanel.add(line1); listpanel.add(line2); listpanel.add(line3); // listpanel.add(tip1); // listpanel.add(tip2); listpanel.add(outList); listpanel.add(ok); listpanel.add(cancel); listpanel.add(bar); // listpanel.add(code); listpanel.add(cargoinfo); listpanel.add(outDate); listpanel.add(distination); listpanel.add(loadingtype); listpanel.add(damageCondition); listpanel.add(good); listpanel.add(damage); listpanel.add(pB); listpanel.add(bB); listpanel.add(tB); // listpanel.add(transfercode); listpanel.add(vehicleCode); listpanel.add(vehtext); listpanel.add(bartext); // listpanel.add(codetext); listpanel.add(distext); // listpanel.add(transtext); ok.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { String date = ((year.getSelectedIndex() + 2000) + "/") + ((month.getSelectedIndex() + 1) + "/") + ((day.getSelectedIndex() + 1 + "")); String damageCondition = null; if (good.isSelected()) { damageCondition = "完好"; } if (damage.isSelected()) { damageCondition = "损坏"; } TransType transtype = TransType.BUS; if (tB.isSelected()) { transtype = TransType.TRAIN; } if (bB.isSelected()) { transtype = TransType.BUS; } if (pB.isSelected()) { transtype = TransType.PLANE; } WarehouseMemory memory = (WarehouseMemory) ((WritePanel) panel).getMemory(); String code = memory.getWarehouseOutCode(); ReceiptCode cal = ConstructFactory.calculateCode(); code = cal.calculCode(code, memory.getUserName()); System.out.println(code); // code出库单号、bar为订单号 WarehouseOutVO warehouseOutVO = new WarehouseOutVO( bartext.getText(), code, distext.getText(), date, transtype, ((WritePanel) panel).getBelong(), vehtext.getText(), damageCondition); WarehouseBLService service = ConstructFactory.WarehouseFactory(); boolean key = service.WarehouseOut(warehouseOutVO); if (key) { WarehouseReceipt wr = ConstructFactory.WarehouseReceiptFactory(); wr.saveWarehouseOutCode(code, memory.getUserName()); memory.setWarehouseOutCode(memory.getWarehouseOutCode() + " " + code); memory.setWarehouseOutDate(memory.getWarehouseOutDate() + " " + date); } } }); cancel.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { remove(); panel.repaint(); } }); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ private void initComponents() { lbTableName = new javax.swing.JLabel(); tfTableName = new javax.swing.JTextField(); lbTableType = new javax.swing.JLabel(); cbTableType = new javax.swing.JComboBox(); lbFields = new javax.swing.JLabel(); tfFieldName = new javax.swing.JTextField(); btAdd = new javax.swing.JButton(); lbFieldProp = new javax.swing.JLabel(); lbFieldType = new javax.swing.JLabel(); cbFieldType = new javax.swing.JComboBox(); lbFieldLength = new javax.swing.JLabel(); tfFieldLength = new javax.swing.JTextField(); lbDefault = new javax.swing.JLabel(); tfDefault = new javax.swing.JTextField(); chPrimary = new javax.swing.JCheckBox(); chIndex = new javax.swing.JCheckBox(); chUnique = new javax.swing.JCheckBox(); chBinary = new javax.swing.JCheckBox(); chNotNull = new javax.swing.JCheckBox(); chUnsigned = new javax.swing.JCheckBox(); chAuto = new javax.swing.JCheckBox(); chZeroFill = new javax.swing.JCheckBox(); listFields = new javax.swing.JList(new DefaultListModel()); btCreateTable = new javax.swing.JButton(); btRemove = new javax.swing.JButton(); btCancel = new javax.swing.JButton(); jd = new JDialog( _session.getApplication().getMainFrame(), // i18n[mysql.createTableComm=Create Table...] s_stringMgr.getString("mysql.createTableComm")); jd.getContentPane().setLayout(null); addWindowListener( new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); // i18n[mysql.tableNamelbl=Table Name:] lbTableName.setText(s_stringMgr.getString("mysql.tableNamelbl")); jd.getContentPane().add(lbTableName); lbTableName.setBounds(20, 30, 70, 16); tfTableName.setText("TableName"); jd.getContentPane().add(tfTableName); tfTableName.setBounds(120, 30, 100, 20); lbTableType.setFont(new java.awt.Font("Dialog", 0, 12)); lbTableType.setText("Table Type:"); jd.getContentPane().add(lbTableType); lbTableType.setBounds(20, 60, 70, 16); cbTableType.setFont(new java.awt.Font("Dialog", 0, 12)); cbTableType.setModel( new javax.swing.DefaultComboBoxModel( new String[] {"<Automatic>", "ISAM", "MyISAM", "MERGE", "InnoDb", "HEAP", "BDB"})); jd.getContentPane().add(cbTableType); cbTableType.setBounds(120, 60, 100, 20); lbFields.setText("Fields:"); lbFields.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(1, 1, 1, 1))); jd.getContentPane().add(lbFields); lbFields.setBounds(10, 120, 40, 18); tfFieldName.setText("FieldName"); tfFieldName.addFocusListener( new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { tfFieldNameFocusGained(evt); } }); jd.getContentPane().add(tfFieldName); tfFieldName.setBounds(10, 150, 110, 20); btAdd.setFont(new java.awt.Font("Dialog", 0, 12)); // i18n[mysql.createAdd=Add] btAdd.setText(s_stringMgr.getString("mysql.createAdd")); btAdd.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btAddActionPerformed(evt); } }); jd.getContentPane().add(btAdd); btAdd.setBounds(130, 150, 80, 26); // i18n[mysql.fieldProps=Field Properties:] lbFieldProp.setText(s_stringMgr.getString("mysql.fieldProps")); lbFieldProp.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(1, 1, 1, 1))); jd.getContentPane().add(lbFieldProp); lbFieldProp.setBounds(220, 150, 100, 20); lbFieldType.setFont(new java.awt.Font("Dialog", 0, 12)); lbFieldType.setText("Type"); jd.getContentPane().add(lbFieldType); lbFieldType.setBounds(220, 190, 41, 16); cbFieldType.setFont(new java.awt.Font("Dialog", 0, 12)); cbFieldType.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "TINYINT", "SMALLINT", "MEDIUMINT", "INT", "BIGINT", "FLOAT", "DOUBLE", "DECIMAL", "DATE", "DATETIME", "TIMESTAMP", "TIME", "YEAR", "CHAR", "VARCHAR", "TINYBLOB", "TINYTEXT", "TEXT", "BLOB", "MEDIUMBLOB", "MEDIUMTEXT", "LONGBLOB", "LONGTEXT", "ENUM", "SET" })); cbFieldType.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cbFieldTypeActionPerformed(evt); } }); jd.getContentPane().add(cbFieldType); cbFieldType.setBounds(300, 190, 110, 20); lbFieldLength.setFont(new java.awt.Font("Dialog", 0, 12)); // i18n[mysql.lengtSet=Length/Set] lbFieldLength.setText(s_stringMgr.getString("mysql.lengtSet")); jd.getContentPane().add(lbFieldLength); lbFieldLength.setBounds(220, 220, 70, 16); jd.getContentPane().add(tfFieldLength); tfFieldLength.setBounds(300, 220, 110, 20); lbDefault.setFont(new java.awt.Font("Dialog", 0, 12)); // i18n[mysql.defaultValue=Default Value] lbDefault.setText(s_stringMgr.getString("mysql.defaultValue")); jd.getContentPane().add(lbDefault); lbDefault.setBounds(220, 250, 80, 16); jd.getContentPane().add(tfDefault); tfDefault.setBounds(300, 250, 110, 20); chPrimary.setFont(new java.awt.Font("Dialog", 0, 12)); chPrimary.setText("Primary"); chPrimary.addItemListener( new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { chPrimaryItemStateChanged(evt); } }); jd.getContentPane().add(chPrimary); chPrimary.setBounds(220, 290, 67, 20); chIndex.setFont(new java.awt.Font("Dialog", 0, 12)); chIndex.setText("Index"); jd.getContentPane().add(chIndex); chIndex.setBounds(290, 290, 54, 20); chUnique.setFont(new java.awt.Font("Dialog", 0, 12)); chUnique.setText("Unique"); jd.getContentPane().add(chUnique); chUnique.setBounds(350, 290, 65, 20); chBinary.setFont(new java.awt.Font("Dialog", 0, 12)); chBinary.setText("Binary"); jd.getContentPane().add(chBinary); chBinary.setBounds(220, 320, 70, 20); chNotNull.setFont(new java.awt.Font("Dialog", 0, 12)); chNotNull.setText("Not Null"); jd.getContentPane().add(chNotNull); chNotNull.setBounds(290, 320, 70, 20); chUnsigned.setFont(new java.awt.Font("Dialog", 0, 12)); chUnsigned.setText("Unsigned"); jd.getContentPane().add(chUnsigned); chUnsigned.setBounds(360, 320, 80, 20); chAuto.setFont(new java.awt.Font("Dialog", 0, 12)); chAuto.setText("Auto Increment"); jd.getContentPane().add(chAuto); chAuto.setBounds(220, 350, 110, 20); chZeroFill.setFont(new java.awt.Font("Dialog", 0, 12)); chZeroFill.setText("Zero Fill"); jd.getContentPane().add(chZeroFill); chZeroFill.setBounds(330, 350, 69, 20); listFields.addListSelectionListener( new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { listFieldsValueChanged(evt); } }); JScrollPane scrollPane = new JScrollPane(listFields); jd.getContentPane().add(scrollPane); scrollPane.setBounds(10, 190, 110, 150); btCreateTable.setFont(new java.awt.Font("Dialog", 0, 12)); // i18n[mysql.createTableBtn=Create table] btCreateTable.setText(s_stringMgr.getString("mysql.createTableBtn")); btCreateTable.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btCreateTableActionPerformed(evt); } }); jd.getContentPane().add(btCreateTable); btCreateTable.setBounds(221, 380, 110, 26); btRemove.setFont(new java.awt.Font("Dialog", 0, 12)); // i18n[mysql.btRemove=Remove] btRemove.setText(s_stringMgr.getString("mysql.btRemove")); btRemove.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btRemoveActionPerformed(evt); } }); jd.getContentPane().add(btRemove); btRemove.setBounds(130, 190, 80, 26); btCancel.setFont(new java.awt.Font("Dialog", 0, 12)); // i18n[mysql.btCancel=Cancel] btCancel.setText(s_stringMgr.getString("mysql.btCancel")); btCancel.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btCancelActionPerformed(evt); } }); jd.getContentPane().add(btCancel); btCancel.setBounds(340, 380, 73, 26); jd.pack(); jd.setSize(450, 450); jd.setLocation(100, 100); jd.setVisible(true); }
public SpecialsGUI(String usersID, int bookingid) { setLayout(null); specials = new JPanel(); specials.setBounds(125, 210, 743, 288); add(specials); specials.setLayout(null); font = new Font("Veranda", font.PLAIN, 18); this.bookingid = bookingid; this.usersID = usersID; addSomething = new JLabel( "Add something extra to your stay with us," + " by selecting from our range of available specials"); addSomething.setFont(font); addSomething.setBounds(10, 0, 760, 36); specials.add(addSomething); golf = new JCheckBox("Golf"); golf.setFont(font); golf.setBounds(323, 165, 160, 23); golf.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (golf.isSelected()) { priceField = priceField + 100; price.setText("Price: €" + priceField); numGolf++; } else { priceField = priceField - 100; price.setText("Price: €" + priceField); numGolf--; } } }); specials.add(golf); spa = new JCheckBox("Spa Treatment"); spa.setFont(font); spa.setBounds(323, 87, 160, 23); spa.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (spa.isSelected()) { priceField = priceField + 150; price.setText("Price: €" + priceField); numSpa++; } else { priceField = priceField - 150; price.setText("Price: €" + priceField); numSpa--; } } }); specials.add(spa); breaky = new JCheckBox("Breakfast"); breaky.setFont(font); breaky.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (breaky.isSelected()) { priceField = priceField + 20; price.setText("Price: €" + priceField); numBreaky++; } else { priceField = priceField - 20; price.setText("Price: €" + priceField); numBreaky--; } } }); breaky.setBounds(323, 139, 160, 23); specials.add(breaky); karting = new JCheckBox("Go-karting"); karting.setFont(font); karting.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (karting.isSelected()) { priceField = priceField + 50; price.setText("Price: €" + priceField); numKarting++; } else { priceField = priceField - 50; price.setText("Price: €" + priceField); numKarting--; } } }); karting.setBounds(323, 113, 160, 23); specials.add(karting); price = new JLabel("Price: €" + priceField); price.setFont(font); price.setBounds(317, 205, 140, 14); specials.add(price); addSpecials = new JButton("Add Specials"); addSpecials.setFont(font); addSpecials.setBackground(color); addSpecials.addActionListener(this); addSpecials.setBounds(206, 230, 150, 23); specials.add(addSpecials); back = new JButton("Back"); back.setFont(font); back.setBackground(color); back.addActionListener(this); back.setBounds(386, 230, 150, 23); specials.add(back); }
public void openKarte() { boolean showReceiptMessage = Project.getBoolean("showReceiptMessage", true); if (showReceiptMessage) { JLabel msg1 = new JLabel("受付リストからオープンしないと診療データをレセコンに"); JLabel msg2 = new JLabel("送信することができません。続けますか?"); final JCheckBox cb = new JCheckBox("今後このメッセージを表示しない"); cb.setFont(new Font("Dialog", Font.PLAIN, 10)); cb.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Project.setBoolean("showReceiptMessage", !cb.isSelected()); } }); JPanel p1 = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 3)); p1.add(msg1); JPanel p2 = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 3)); p2.add(msg2); JPanel p3 = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 3)); p3.add(cb); JPanel box = new JPanel(); box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS)); box.add(p1); box.add(p2); box.add(p3); box.setBorder(BorderFactory.createEmptyBorder(0, 0, 11, 11)); int option = JOptionPane.showConfirmDialog( SwingUtilities.getWindowAncestor(getUI()), new Object[] {box}, ClientContext.getFrameTitle(getName()), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, ClientContext.getImageIcon("about_32.gif")); if (option != JOptionPane.YES_OPTION) { return; } } PatientModel patient = selectedLabo.getPatient(); PatientVisitModel pvt = new PatientVisitModel(); pvt.setNumber(number++); pvt.setPatientModel(patient); // 受け付けを通していないので診療科はユーザ登録してあるものを使用する // 診療科名、診療科コード、医師名、医師コード、JMARI // 2.0 pvt.setDeptName(Project.getUserModel().getDepartmentModel().getDepartmentDesc()); pvt.setDeptCode(Project.getUserModel().getDepartmentModel().getDepartment()); pvt.setDoctorName(Project.getUserModel().getCommonName()); if (Project.getUserModel().getOrcaId() != null) { pvt.setDoctorId(Project.getUserModel().getOrcaId()); } else { pvt.setDoctorId(Project.getUserModel().getUserId()); } pvt.setJmariNumber(Project.getString(Project.JMARI_CODE)); // カルテコンテナを生成する getContext().openKarte(pvt); }
/** Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setResizable(false); frame.setBounds(100, 100, 505, 467); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); frame.setLocationRelativeTo(null); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBounds(0, 0, 500, 442); /*Camera Report Panel*/ CameraReportPanel = new JPanel(); tabbedPane.add("Camera Report", CameraReportPanel); tabbedPane.setEnabledAt(0, true); CameraReportPanel.setLayout(null); JLabel label = new JLabel("Insert First Part of IP (xxx.xxx.xxx):"); label.setFont(new Font("Tahoma", Font.PLAIN, 14)); label.setBounds(36, 40, 232, 25); CameraReportPanel.add(label); JLabel label_1 = new JLabel("Insert Starting Host Number:"); label_1.setFont(new Font("Tahoma", Font.PLAIN, 14)); label_1.setBounds(36, 72, 181, 17); CameraReportPanel.add(label_1); JLabel label_2 = new JLabel("Insert Ending Host Number:"); label_2.setFont(new Font("Tahoma", Font.PLAIN, 14)); label_2.setBounds(36, 112, 181, 17); CameraReportPanel.add(label_2); sOctet = new JTextField(); sOctet.setFont(new Font("Dialog", Font.PLAIN, 20)); sOctet.addFocusListener(this); sOctet.setColumns(10); sOctet.setBounds(278, 70, 40, 25); CameraReportPanel.add(sOctet); eOctet = new JTextField(); eOctet.setFont(new Font("Dialog", Font.PLAIN, 20)); eOctet.addFocusListener(this); eOctet.setColumns(10); eOctet.setBounds(278, 110, 40, 25); CameraReportPanel.add(eOctet); JLabel label_3 = new JLabel("Enter Username:"******"Tahoma", Font.PLAIN, 14)); label_3.setBounds(36, 205, 106, 14); CameraReportPanel.add(label_3); JLabel label_4 = new JLabel("Enter Password:"******"Tahoma", Font.PLAIN, 14)); label_4.setBounds(36, 249, 106, 14); CameraReportPanel.add(label_4); uName = new JTextField(); uName.setFont(new Font("Tahoma", Font.PLAIN, 19)); uName.addFocusListener(this); uName.setText("root"); uName.setColumns(10); uName.setBounds(143, 195, 149, 32); CameraReportPanel.add(uName); passwordField = new JPasswordField(); passwordField.setFont(new Font("Tahoma", Font.PLAIN, 19)); passwordField.addFocusListener(this); passwordField.setText("p@ssw0rd"); passwordField.setBounds(143, 239, 149, 32); CameraReportPanel.add(passwordField); checkBoxPing = new JCheckBox("Ping Address"); checkBoxPing.setFont(new Font("Tahoma", Font.PLAIN, 14)); checkBoxPing.setSelected(true); checkBoxPing.setBounds(36, 144, 125, 23); CameraReportPanel.add(checkBoxPing); progressBar = new JProgressBar(); progressBar.setString(""); progressBar.setStringPainted(true); progressBar.setBounds(68, 331, 374, 32); CameraReportPanel.add(progressBar); CamReportBtn = new JButton("Run"); CamReportBtn.addActionListener(this); CamReportBtn.setBounds(201, 282, 104, 38); CameraReportPanel.add(CamReportBtn); firstOctet = new JTextField(); firstOctet.addFocusListener(this); firstOctet.setFont(new Font("Tahoma", Font.PLAIN, 20)); firstOctet.setText("10"); firstOctet.setColumns(3); firstOctet.setBounds(278, 38, 40, 25); CameraReportPanel.add(firstOctet); secondOctet = new JTextField(); secondOctet.addFocusListener(this); secondOctet.setFont(new Font("Dialog", Font.PLAIN, 20)); secondOctet.setColumns(3); secondOctet.setBounds(328, 37, 40, 25); CameraReportPanel.add(secondOctet); thirdOctet = new JTextField(); thirdOctet.addFocusListener(this); thirdOctet.setFont(new Font("Dialog", Font.PLAIN, 20)); thirdOctet.setColumns(3); thirdOctet.setBounds(378, 37, 40, 25); CameraReportPanel.add(thirdOctet); JLabel label_5 = new JLabel("."); label_5.setFont(new Font("Dialog", Font.BOLD, 17)); label_5.setBounds(320, 50, 4, 14); CameraReportPanel.add(label_5); JLabel label_6 = new JLabel("."); label_6.setFont(new Font("Dialog", Font.BOLD, 17)); label_6.setBounds(370, 50, 4, 14); CameraReportPanel.add(label_6); /*Host Uploader Panel*/ frame.getContentPane().add(tabbedPane); JComponent HostUploaderPanel = new JPanel(); tabbedPane.add("Host Uploader", HostUploaderPanel); tabbedPane.setEnabledAt(1, true); HostUploaderPanel.setLayout(null); hostUploaderBrowseBtn = new JButton("Browse"); hostUploaderBrowseBtn.addActionListener(this); hostUploaderBrowseBtn.setBounds(23, 82, 117, 29); HostUploaderPanel.add(hostUploaderBrowseBtn); filePath = new JTextField(); filePath.addFocusListener(this); filePath.setFont(new Font("Tahoma", Font.PLAIN, 10)); filePath.setBounds(150, 86, 318, 20); HostUploaderPanel.add(filePath); filePath.setColumns(10); hostUploaderRunBtn = new JButton("Run"); hostUploaderRunBtn.setFont(new Font("Tahoma", Font.PLAIN, 15)); hostUploaderRunBtn.addActionListener(this); hostUploaderRunBtn.setBounds(157, 334, 186, 60); hostUploaderRunBtn.setEnabled(false); HostUploaderPanel.add(hostUploaderRunBtn); JLabel label_7 = new JLabel("Insert First Part of IP (xxx.xxx.xxx):"); label_7.setFont(new Font("Tahoma", Font.PLAIN, 14)); label_7.setBounds(23, 125, 232, 25); HostUploaderPanel.add(label_7); textField_7 = new JTextField(); textField_7.addFocusListener(this); textField_7.setText("10"); textField_7.setFont(new Font("Tahoma", Font.PLAIN, 20)); textField_7.setColumns(3); textField_7.setBounds(265, 123, 40, 25); HostUploaderPanel.add(textField_7); textField_8 = new JTextField(); textField_8.addFocusListener(this); textField_8.setFont(new Font("Dialog", Font.PLAIN, 20)); textField_8.setColumns(3); textField_8.setBounds(315, 122, 40, 25); HostUploaderPanel.add(textField_8); textField_9 = new JTextField(); textField_9.addFocusListener(this); textField_9.setFont(new Font("Dialog", Font.PLAIN, 20)); textField_9.setColumns(3); textField_9.setBounds(365, 122, 40, 25); HostUploaderPanel.add(textField_9); JLabel label_8 = new JLabel("Insert Starting Host Number:"); label_8.setFont(new Font("Tahoma", Font.PLAIN, 14)); label_8.setBounds(23, 157, 181, 17); HostUploaderPanel.add(label_8); textField_10 = new JTextField(); textField_10.addFocusListener(this); textField_10.setFont(new Font("Dialog", Font.PLAIN, 20)); textField_10.setColumns(10); textField_10.setBounds(265, 155, 40, 25); HostUploaderPanel.add(textField_10); JLabel label_9 = new JLabel("Insert Ending Host Number:"); label_9.setFont(new Font("Tahoma", Font.PLAIN, 14)); label_9.setBounds(23, 197, 181, 17); HostUploaderPanel.add(label_9); textField_11 = new JTextField(); textField_11.addFocusListener(this); textField_11.setFont(new Font("Dialog", Font.PLAIN, 20)); textField_11.setColumns(10); textField_11.setBounds(265, 195, 40, 25); HostUploaderPanel.add(textField_11); JLabel label_10 = new JLabel("Enter Username:"******"Tahoma", Font.PLAIN, 14)); label_10.setBounds(23, 265, 106, 14); HostUploaderPanel.add(label_10); textField_12 = new JTextField(); textField_12.addFocusListener(this); textField_12.setText("root"); textField_12.setFont(new Font("Tahoma", Font.PLAIN, 19)); textField_12.setColumns(10); textField_12.setBounds(130, 255, 149, 32); HostUploaderPanel.add(textField_12); JLabel label_11 = new JLabel("Enter Password:"******"Tahoma", Font.PLAIN, 14)); label_11.setBounds(23, 309, 106, 14); HostUploaderPanel.add(label_11); passwordField_1 = new JPasswordField(); passwordField_1.addFocusListener(this); passwordField_1.setText("p@ssw0rd"); passwordField_1.setFont(new Font("Tahoma", Font.PLAIN, 19)); passwordField_1.setBounds(130, 291, 149, 32); HostUploaderPanel.add(passwordField_1); JLabel lblNewLabel = new JLabel("NOTE: Running this program REBOOTS the Camera(s)"); lblNewLabel.setForeground(Color.RED); lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 18)); lblNewLabel.setBounds(23, 17, 445, 54); HostUploaderPanel.add(lblNewLabel); JLabel label_12 = new JLabel("."); label_12.setFont(new Font("Dialog", Font.BOLD, 17)); label_12.setBounds(308, 132, 4, 14); HostUploaderPanel.add(label_12); JLabel label_13 = new JLabel("."); label_13.setFont(new Font("Dialog", Font.BOLD, 17)); label_13.setBounds(358, 132, 4, 14); HostUploaderPanel.add(label_13); JComponent snmpReportPanel = new JPanel(); tabbedPane.add("SNMP Report", snmpReportPanel); tabbedPane.setEnabledAt(2, true); }
/** Sets up the GUI (panels, buttons, etc) and displays it on the screen. */ private void init() { DecimalFormat df; int xUnits; String unitStr; String distStr; setForeground(Color.black); setTitle("Center Distances version 2 07/14/08"); df = new DecimalFormat("0.000E0"); GridBagConstraints gbc = new GridBagConstraints(); int yPos = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.anchor = GridBagConstraints.WEST; gbc.weightx = 1; gbc.insets = new Insets(3, 3, 3, 3); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = yPos++; JPanel mainPanel = new JPanel(new GridBagLayout()); mainPanel.setForeground(Color.black); mainPanel.setBorder(buildTitledBorder("Input parameters")); blueMinLabel = new JLabel("Minimum number of blue pixels per nucleus"); blueMinLabel.setForeground(Color.black); blueMinLabel.setFont(serif12); gbc.gridx = 0; gbc.gridy = yPos; mainPanel.add(blueMinLabel, gbc); blueMinText = new JTextField(5); if (image.getNDims() == 2) { blueMinText.setText("1000"); } else { blueMinText.setText("20000"); } blueMinText.setFont(serif12); gbc.gridx = 1; gbc.gridy = yPos++; mainPanel.add(blueMinText, gbc); redMinLabel = new JLabel("Minimum red pixel count"); redMinLabel.setForeground(Color.black); redMinLabel.setFont(serif12); gbc.gridx = 0; gbc.gridy = yPos; mainPanel.add(redMinLabel, gbc); redMinText = new JTextField(5); redMinText.setText("50"); redMinText.setFont(serif12); gbc.gridx = 1; gbc.gridy = yPos++; mainPanel.add(redMinText, gbc); redFractionLabel = new JLabel("Fraction of red pixels to consider"); redFractionLabel.setForeground(Color.black); redFractionLabel.setFont(serif12); gbc.gridx = 0; gbc.gridy = yPos; mainPanel.add(redFractionLabel, gbc); redFractionText = new JTextField(5); redFractionText.setText("0.15"); redFractionText.setFont(serif12); gbc.gridx = 1; gbc.gridy = yPos++; mainPanel.add(redFractionText, gbc); xUnits = image.getFileInfo(0).getUnitsOfMeasure()[0]; if (xUnits != Unit.UNKNOWN_MEASURE.getLegacyNum()) { unitStr = (Unit.getUnitFromLegacyNum(xUnits)).toString(); greenMergingLabel = new JLabel("Green merging radius around peak (" + unitStr + ")"); } else { greenMergingLabel = new JLabel("Green merging radius around peak"); } greenMergingLabel.setForeground(Color.black); greenMergingLabel.setFont(serif12); gbc.gridx = 0; gbc.gridy = yPos; mainPanel.add(greenMergingLabel, gbc); if (image.getNDims() == 2) { // mergingDistance = 8.0f * image.getFileInfo(0).getResolutions()[0]; mergingDistance = 0.0f; } else { // mergingDistance = 4.0f * image.getFileInfo(0).getResolutions()[0]; mergingDistance = 0.0f; } distStr = df.format(mergingDistance); greenMergingText = new JTextField(10); greenMergingText.setText(distStr); greenMergingText.setFont(serif12); gbc.gridx = 1; gbc.gridy = yPos++; mainPanel.add(greenMergingText, gbc); greenMinLabel = new JLabel("Minimum green pixel count"); greenMinLabel.setForeground(Color.black); greenMinLabel.setFont(serif12); gbc.gridx = 0; gbc.gridy = yPos; mainPanel.add(greenMinLabel, gbc); greenMinText = new JTextField(5); greenMinText.setText("10"); greenMinText.setFont(serif12); gbc.gridx = 1; gbc.gridy = yPos++; mainPanel.add(greenMinText, gbc); greenFractionLabel = new JLabel("Fraction of green pixels to consider"); greenFractionLabel.setForeground(Color.black); greenFractionLabel.setFont(serif12); gbc.gridx = 0; gbc.gridy = yPos; mainPanel.add(greenFractionLabel, gbc); greenFractionText = new JTextField(5); greenFractionText.setText("0.01"); greenFractionText.setFont(serif12); gbc.gridx = 1; gbc.gridy = yPos++; mainPanel.add(greenFractionText, gbc); greenRegionsLabel = new JLabel("Green regions per cell"); greenRegionsLabel.setForeground(Color.black); greenRegionsLabel.setFont(serif12); gbc.gridx = 0; gbc.gridy = yPos; mainPanel.add(greenRegionsLabel, gbc); JPanel buttonPanel = new JPanel(new GridBagLayout()); greenGroup = new ButtonGroup(); oneButton = new JRadioButton("1", false); oneButton.setForeground(Color.black); oneButton.setFont(serif12); greenGroup.add(oneButton); gbc.gridx = 0; gbc.gridy = 0; buttonPanel.add(oneButton, gbc); twoButton = new JRadioButton("2", true); twoButton.setForeground(Color.black); twoButton.setFont(serif12); greenGroup.add(twoButton); gbc.gridx = 1; gbc.gridy = 0; buttonPanel.add(twoButton, gbc); threeButton = new JRadioButton("3", false); threeButton.setForeground(Color.black); threeButton.setFont(serif12); greenGroup.add(threeButton); gbc.gridx = 2; gbc.gridy = 0; buttonPanel.add(threeButton, gbc); fourButton = new JRadioButton("4", false); fourButton.setForeground(Color.black); fourButton.setFont(serif12); greenGroup.add(fourButton); gbc.gridx = 3; gbc.gridy = 0; buttonPanel.add(fourButton, gbc); gbc.gridx = 1; gbc.gridy = yPos++; mainPanel.add(buttonPanel, gbc); twoBox = new JCheckBox("Use 2 top gray levels in green segmentation", true); twoBox.setForeground(Color.black); twoBox.setFont(serif12); gbc.gridx = 0; gbc.gridy = yPos++; mainPanel.add(twoBox, gbc); blueValueLabel = new JLabel("Fraction of blue transition from image min to max at nucleus boundary"); blueValueLabel.setForeground(Color.black); blueValueLabel.setFont(serif12); gbc.gridx = 0; gbc.gridy = yPos; mainPanel.add(blueValueLabel, gbc); blueValueText = new JTextField(5); blueValueText.setText("0.15"); blueValueText.setFont(serif12); gbc.gridx = 1; gbc.gridy = yPos++; mainPanel.add(blueValueText, gbc); blueSmoothBox = new JCheckBox("Smooth blue VOI contours with AlgorithmBSmooth", true); blueSmoothBox.setForeground(Color.black); blueSmoothBox.setFont(serif12); blueSmoothBox.addActionListener(this); gbc.gridx = 0; gbc.gridy = yPos++; mainPanel.add(blueSmoothBox, gbc); interpolationLabel = new JLabel("Number of interpolation points determined by divisor (> 1.0)"); interpolationLabel.setForeground(Color.black); interpolationLabel.setFont(serif12); gbc.gridx = 0; gbc.gridy = yPos; mainPanel.add(interpolationLabel, gbc); interpolationText = new JTextField(5); interpolationText.setText("24.0"); interpolationText.setFont(serif12); gbc.gridx = 1; gbc.gridy = yPos++; mainPanel.add(interpolationText, gbc); getContentPane().add(mainPanel, BorderLayout.CENTER); getContentPane().add(buildButtons(), BorderLayout.SOUTH); pack(); setVisible(true); setResizable(false); System.gc(); } // end init()
/** * Updates this class'es font by using the <CODE>ViewStateModel</CODE>. Will be called from the * <CODE>propertyChange()</CODE> method which is obligated due to the implemented interface. * * @param model The <CODE>ViewStateModel</CODE>. */ protected void updateViewState(ViewStateModel model) { cb.setFont(model.getFont()); label.setFont(model.getFont()); }
public void updateFont() { Font font = app.getPlainFont(); cbShowFormulaBar.setFont(font); cbShowGrid.setFont(font); cbShowColumnHeader.setFont(font); cbShowRowHeader.setFont(font); cbShowHScrollbar.setFont(font); cbShowVScrollbar.setFont(font); cbAllowSpecialEditor.setFont(font); cbAllowToolTips.setFont(font); cbPrependCommands.setFont(font); cbEnableAutoComplete.setFont(font); cbShowNavigation.setFont(font); }
/** * This method represents the window in which the preferred obix components can be chosen. * * @return The container in which the preferred obix components can be chosen. */ private Container chooseComponents() { Container pane = new Container(); pane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); pane.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = 1; c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 1; c.insets = new Insets(5, 5, 5, 5); registeredColibriChannelCheckBox = new JCheckBox("IS REGISTERD ON COLIBRI SEMANTIC CORE"); commandFactory.addCommand( () -> registeredColibriChannelCheckBox.setSelected( connector.getColibriChannel().getRegistered())); Font regF = new Font("Courier", Font.BOLD, 40); registeredColibriChannelCheckBox.setFont(regF); /** * Listener for the checkbox which indicates, if the obix connector is registered at colibri. */ registeredColibriChannelCheckBox.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { if (!connector.getColibriChannel().getRegistered()) { connector.getColibriChannel().send(ColibriMessage.createRegisterMessage(connector)); } } else { if (connector.getColibriChannel().getRegistered()) { connector .getColibriChannel() .send(ColibriMessage.createDeregisterMessage(connector)); } } } }); pane.add(registeredColibriChannelCheckBox, c); Font titelF = new Font("Courier", Font.BOLD, 30); title = new JLabel("Please choose the components you want to work with"); title.setFont(titelF); c.gridy++; pane.add(title, c); JTextField searchTextField = new JTextField("Search for a component"); c.weightx = 1; c.weighty = 1; c.gridx++; pane.add(searchTextField, c); c.weightx = 0.25; c.weighty = 0.25; c.gridwidth = 1; c.gridx++; JButton searchButton = new JButton("Search"); pane.add(searchButton, c); JCheckBox markAllCheckbox = new JCheckBox("Mark all components"); c.gridy++; c.gridy++; pane.add(markAllCheckbox, c); for (String s : lobby.getObservedObjectsLists().keySet()) { if (!s.equals("all")) { List<ObixObject> objects = lobby.getObservedObjectsLists().get(s); JLabel header = new JLabel(s); Font headerF = new Font("Courier", Font.BOLD, 25); header.setFont(headerF); c.gridx = 0; c.gridy++; pane.add(header, c); for (ObixObject o : objects) { JCheckBox chooseCheckBox = new JCheckBox(o.getObixUri()); JPanel innerPanel = new JPanel(); innerPanel.setLayout(new FlowLayout(0, 0, 0)); innerPanel.add(chooseCheckBox); c.gridx = 0; c.gridwidth = 10; c.gridy++; pane.add(innerPanel, c); representationRows.add(new RepresentationRow(o, chooseCheckBox)); } } } JButton acceptButton = new JButton("Accept"); c.gridx = 0; c.gridy++; pane.add(acceptButton, c); /** Accept button listener */ Action acceptAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { List<ObixObject> chosenObjects = Collections.synchronizedList(new ArrayList<>()); ; for (RepresentationRow r : GuiUtility.this.getRepresentationRows()) { if (r.getChooseCheckbox().isSelected()) { chosenObjects.add(r.getObixObject()); } } representationRows.clear(); cards.removeAll(); JScrollPane scrollPane = new JScrollPane(chooseParameters(chosenObjects)); scrollPane.getVerticalScrollBar().setUnitIncrement(16); scrollPane.setBorder(new EmptyBorder(20, 20, 20, 20)); cards.add(scrollPane); // Display the window. mainFrame.pack(); } }; acceptButton.addActionListener(acceptAction); /** Search function listener */ Action searchAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { String searchText = searchTextField.getText(); for (RepresentationRow r : GuiUtility.this.getRepresentationRows()) { if (r.getChooseCheckbox().getText().contains(searchText)) { r.getChooseCheckbox().setForeground(Color.blue); } else { r.getChooseCheckbox().setForeground(Color.black); } r.getChooseCheckbox().revalidate(); r.getChooseCheckbox().repaint(); } } }; searchTextField.addActionListener(searchAction); searchButton.addActionListener(searchAction); /** Mark all components function listener */ Action markAllAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { for (RepresentationRow r : GuiUtility.this.getRepresentationRows()) { r.getChooseCheckbox().setSelected(true); } } }; markAllCheckbox.addActionListener(markAllAction); return pane; }