List of usage examples for java.awt.event FocusAdapter FocusAdapter
FocusAdapter
From source file:gtu._work.ui.EstoreCodeGenerateUI.java
private void initGUI() { try {//from w w w . j a v a2 s .com BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); jTabbedPane1.setPreferredSize(new java.awt.Dimension(717, 582)); { jPanel1 = new JPanel(); GridLayout jPanel1Layout = new GridLayout(15, 1); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("", null, jPanel1, null); { jLabel1 = new JLabel(); jPanel1.add(jLabel1); jLabel1.setText("\u985e\u5225\u540d\u7a31"); } { classNameText = new JTextField(); jPanel1.add(classNameText); } { jLabel6 = new JLabel(); jPanel1.add(jLabel6); jLabel6.setText("package\u4e2d\u9593\u540d"); } { packageMiddleNameText = new JTextField(); jPanel1.add(packageMiddleNameText); } { jLabel2 = new JLabel(); jPanel1.add(jLabel2); jLabel2.setText("jsp\u8def\u5f91"); } { jspPathText = new JTextField(); jPanel1.add(jspPathText); jspPathText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { try { String xmlConfigMessage = xmlConfigArea.getText(); if (StringUtils.isBlank(xmlConfigMessage)) { return; } StringBuilder sb = new StringBuilder(); String actionClassPath = jspPathText.getText(); actionClassPath = actionClassPath.replaceFirst("/src/main/webapp", ""); Pattern pattern = Pattern.compile("value=\"[\\w\\/]+\\.jsp\""); Matcher matcher = null; BufferedReader reader = new BufferedReader(new StringReader(xmlConfigMessage)); for (String line = null; (line = reader.readLine()) != null;) { matcher = pattern.matcher(line); if (matcher.find()) { StringBuffer sb2 = new StringBuffer(); matcher.appendReplacement(sb2, "value=\"" + actionClassPath + "\""); matcher.appendTail(sb2); sb.append(sb2 + "\n"); } else { sb.append(line + "\n"); } } xmlConfigArea.setText(sb.toString()); } catch (Exception e) { JCommonUtil.handleException(e); } } }); } { jLabel3 = new JLabel(); jPanel1.add(jLabel3); jLabel3.setText("action\u8def\u5f91"); } { actionPathText = new JTextField(); jPanel1.add(actionPathText); actionPathText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { try { String xmlConfigMessage = xmlConfigArea.getText(); if (StringUtils.isBlank(xmlConfigMessage)) { return; } StringBuilder sb = new StringBuilder(); String actionClassPath = actionPathText.getText(); System.out.println(actionClassPath); actionClassPath = actionClassPath.replaceAll("/src/main/java/", "") .replace('/', '.').replaceAll(".java", ""); Pattern pattern = Pattern.compile("class=\"com\\.sti\\.[\\w\\.]+Action\""); Matcher matcher = null; BufferedReader reader = new BufferedReader(new StringReader(xmlConfigMessage)); for (String line = null; (line = reader.readLine()) != null;) { matcher = pattern.matcher(line); if (matcher.find()) { StringBuffer sb2 = new StringBuffer(); matcher.appendReplacement(sb2, "class=\"" + actionClassPath + "\""); matcher.appendTail(sb2); sb.append(sb2 + "\n"); } else { sb.append(line + "\n"); } } xmlConfigArea.setText(sb.toString()); } catch (Exception e) { JCommonUtil.handleException(e); } } }); } { jLabel4 = new JLabel(); jPanel1.add(jLabel4); jLabel4.setText("service interface\u8def\u5f91"); } { serviceInterfaceText = new JTextField(); jPanel1.add(serviceInterfaceText); } { jLabel5 = new JLabel(); jPanel1.add(jLabel5); jLabel5.setText("service Impl\u8def\u5f91"); } { serviceImplText = new JTextField(); jPanel1.add(serviceImplText); serviceImplText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { try { String xmlConfigMessage = xmlConfigArea.getText(); if (StringUtils.isBlank(xmlConfigMessage)) { return; } StringBuilder sb = new StringBuilder(); String actionClassPath = serviceImplText.getText(); actionClassPath = actionClassPath.replaceFirst("/src/main/java/", "") .replaceAll(".java", "").replace('/', '.'); Pattern pattern = Pattern.compile("class=\"com.sti[\\w\\.]+ServiceImpl\""); Matcher matcher = null; BufferedReader reader = new BufferedReader(new StringReader(xmlConfigMessage)); for (String line = null; (line = reader.readLine()) != null;) { matcher = pattern.matcher(line); if (matcher.find()) { StringBuffer sb2 = new StringBuffer(); matcher.appendReplacement(sb2, "class=\"" + actionClassPath + "\""); matcher.appendTail(sb2); sb.append(sb2 + "\n"); } else { sb.append(line + "\n"); } } xmlConfigArea.setText(sb.toString()); } catch (Exception e) { JCommonUtil.handleException(e); } } }); } { updateBtn = new JButton(); jPanel1.add(updateBtn); updateBtn.setText("\u66f4\u65b0"); updateBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { updateBtnActionPerformed(evt); } }); } { makeFileBtn = new JButton(); jPanel1.add(makeFileBtn); makeFileBtn.setText("\u7522\u751f\u6a94\u6848"); makeFileBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { makeFileBtnActionPerformed(evt); } catch (IOException e) { JCommonUtil.handleException(e); } } }); } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("xml", null, jPanel2, null); { jScrollPane1 = new JScrollPane(); jPanel2.add(jScrollPane1, BorderLayout.CENTER); { xmlConfigArea = new JTextArea(); jScrollPane1.setViewportView(xmlConfigArea); } } } } pack(); this.setSize(733, 525); } catch (Exception e) { e.printStackTrace(); } }
From source file:au.org.ala.delta.editor.ui.ImageDetailsPanel.java
private void addEventHandlers() { btnDisplay.setAction(_actions.get("displayImage")); btnAdd.setAction(_actions.get("addImage")); btnDelete.setAction(_actions.get("deleteImage")); btnSettings.setAction(_actions.get("displayImageSettings")); imageList.addListSelectionListener(new ListSelectionListener() { @Override//from w w w . j ava2 s. c om public void valueChanged(ListSelectionEvent e) { _selectedImage = (Image) imageList.getSelectedValue(); _dataSet.setSelectedImage(_selectedImage); updateDisplay(); } }); imageList.setSelectionAction(_actions.get("displayImage")); imageList.setDragEnabled(true); imageList.setDropMode(DropMode.INSERT); imageList.setTransferHandler(new ImageTransferHandler()); playSoundButton.setAction(_actions.get("playSound")); deleteSoundButton.setAction(_actions.get("deleteSound")); insertSoundButton.setAction(_actions.get("addSound")); FocusAdapter focusAdaptor = new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (e.getComponent() == subjectTextPane) { updateSubjectText(); } else if (e.getComponent() == developerNotesTextPane) { updateDeveloperNotes(); } } }; soundComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateSoundActions(); } }); subjectTextPane.addFocusListener(focusAdaptor); developerNotesTextPane.addFocusListener(focusAdaptor); }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopPickerField.java
@Override public void addFieldListener(final FieldListener listener) { final JTextField field = (JTextField) impl.getEditor(); field.addFocusListener(new FocusAdapter() { @Override// w ww . jav a 2 s . c o m public void focusLost(FocusEvent e) { fireFieldListener(listener, field.getText()); } }); field.addKeyListener(new KeyAdapter() { protected static final int ENTER_CODE = 10; @Override public void keyPressed(KeyEvent e) { if (ENTER_CODE == e.getKeyCode()) { fireFieldListener(listener, field.getText()); } } }); }
From source file:view.App.java
private void initGUI() { try {/* w w w .ja v a 2s .c o m*/ { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); getContentPane().add(jPanel1, BorderLayout.CENTER); jPanel1.setPreferredSize(new java.awt.Dimension(901, 398)); { jPanel2 = new JPanel(); BoxLayout jPanel2Layout = new BoxLayout(jPanel2, javax.swing.BoxLayout.Y_AXIS); jPanel2.setLayout(jPanel2Layout); jPanel1.add(jPanel2, BorderLayout.WEST); jPanel2.setPreferredSize(new java.awt.Dimension(292, 446)); { jPanel5 = new JPanel(); jPanel2.add(jPanel5); jPanel5.setPreferredSize(new java.awt.Dimension(292, 109)); { { jTextArea1 = new JTextArea(); jTextArea1.setWrapStyleWord(true); jTextArea1.setLineWrap(true); DefaultCaret caret = (DefaultCaret) jTextArea1.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); jTextArea1.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent evt) { if (jTable1.getModel().getRowCount() == 0 && !jButton1.isEnabled()) { jButton1.setEnabled(true); jTextArea1.setText(""); } } }); JScrollPane sp = new JScrollPane(); sp.setPreferredSize(new java.awt.Dimension(281, 97)); sp.setViewportView(jTextArea1); jPanel5.add(sp, BorderLayout.CENTER); } } } { jPanel4 = new JPanel(); jPanel2.add(jPanel4); FlowLayout jPanel4Layout = new FlowLayout(); jPanel4Layout.setAlignment(FlowLayout.RIGHT); jPanel4.setPreferredSize(new java.awt.Dimension(292, 45)); jPanel4.setSize(102, 51); jPanel4.setLayout(jPanel4Layout); { jButton1 = new JButton(); jPanel4.add(jButton1); jButton1.setText("Get Quotes"); jButton1.setSize(100, 50); jButton1.setPreferredSize(new java.awt.Dimension(100, 26)); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // String tickerStr = jTextArea1.getText(); if (tickerStr.equals("") || tickerStr.equals(null) || tickerStr.equals(" ")) { jTextArea1.setText(" "); return; } StringTokenizer tokenizer = new StringTokenizer(tickerStr, " "); String[] tickers = new String[tokenizer.countTokens()]; int i = 0; while (tokenizer.hasMoreTokens()) { tickers[i] = tokenizer.nextToken(); i++; } try { Controller.getQuotes(tickers); } catch (CloneNotSupportedException e) { JOptionPane.showMessageDialog(jPanel1, " "); } jButton1.setEnabled(false); } }); } } { jPanel6 = new JPanel(); BorderLayout jPanel6Layout = new BorderLayout(); jPanel6.setLayout(jPanel6Layout); jPanel2.add(jPanel6); { jScrollPane1 = new JScrollPane(); jPanel6.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(292, 341)); { TableModel jTable1Model = new DefaultTableModel(null, new String[] { "", "MA Value", "", "MA Value" }); jTable1 = new JTable(); jScrollPane1.setViewportView(jTable1); jTable1.setModel(jTable1Model); jTable1.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); } } } } { jPanel3 = new JPanel(); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); jPanel1.add(jPanel3, BorderLayout.CENTER); { // chart = ChartFactory.createLineChart(" ", "dates", "correlation ratio", null, // PlotOrientation.VERTICAL, true, true, false); // ChartPanel chartPanel = new ChartPanel(chart); // chartPanel.setPreferredSize( new java.awt.Dimension( 560 , 367 ) ); // jPanel3.add(chartPanel); } { } } } this.setSize(966, 531); { jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); { jMenu3 = new JMenu(); jMenuBar1.add(jMenu3); jMenu3.setText("File"); { // newFileMenuItem = new JMenuItem(); // jMenu3.add(newFileMenuItem); // newFileMenuItem.setText("New"); // newFileMenuItem.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent evt) { //// jTextArea1.setText(""); //// DefaultTableModel model = (DefaultTableModel)jTable1.getModel(); //// model.setRowCount(0); //// Controller.clearPortfolio(); // } // }); } { jSeparator2 = new JSeparator(); jMenu3.add(jSeparator2); } { exitMenuItem = new JMenuItem(); jMenu3.add(exitMenuItem); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { int action = JOptionPane.showConfirmDialog(jPanel1, " ?", "Confirm Exit", JOptionPane.OK_CANCEL_OPTION); if (action == JOptionPane.OK_OPTION) System.exit(0); } }); } } { jMenu4 = new JMenu(); jMenuBar1.add(jMenu4); jMenu4.setText("Edit"); { cutMenuItem = new JMenuItem(); jMenu4.add(cutMenuItem); cutMenuItem.setText("Cut"); cutMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String txt = jTextArea1.getText(); StringSelection selection = new StringSelection(txt); Clipboard clp = Toolkit.getDefaultToolkit().getSystemClipboard(); clp.setContents(selection, null); jTextArea1.setText(""); } }); } { copyMenuItem = new JMenuItem(); jMenu4.add(copyMenuItem); copyMenuItem.setText("Copy"); copyMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { String txt = jTextArea1.getText(); StringSelection selection = new StringSelection(txt); Clipboard clp = Toolkit.getDefaultToolkit().getSystemClipboard(); clp.setContents(selection, null); } }); } { pasteMenuItem = new JMenuItem(); jMenu4.add(pasteMenuItem); pasteMenuItem.setText("Paste"); pasteMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Clipboard clp = Toolkit.getDefaultToolkit().getSystemClipboard(); try { String data = (String) clp.getData(DataFlavor.stringFlavor); jTextArea1.setText(data); } catch (UnsupportedFlavorException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); } } { jMenu5 = new JMenu(); jMenuBar1.add(jMenu5); jMenu5.setText("Help"); { helpMenuItem = new JMenuItem(); jMenu5.add(helpMenuItem); helpMenuItem.setText("About"); helpMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JOptionPane.showMessageDialog(jPanel1, " . r.zhumagulov@gmail.com", "About", JOptionPane.PLAIN_MESSAGE); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.pentaho.reporting.libraries.designtime.swing.date.DateCellEditor.java
private void init() { if (dateChooserPanel == null) { dateChooserPanel = new DateChooserPanel(Calendar.getInstance(), true); dateChooserPanel.addPropertyChangeListener(DateChooserPanel.PROPERTY_DATE, new InternalDateUpdateHandler()); dateField.addPropertyChangeListener("value", new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent evt) { Date newValue = (Date) evt.getNewValue(); newValue = newValue == null ? null : DateConverter.convertToDateType(newValue, dateType); dateChooserPanel.setDate(newValue, false); dateChooserPanel.setDateSelected(true); }//ww w . j a va 2 s . c o m }); dateField.addFocusListener(new FocusAdapter() { public void focusGained(final FocusEvent e) { dateChooserPanel.setDateSelected(false); } }); if (dateField.getFormatterFactory() == null) { setDateFormat(createDateFormat(DEFAULT_FORMAT, Locale.getDefault(), TimeZone.getDefault())); } } }
From source file:org.rdv.viz.spectrum.SpectrumViz.java
/** * Initializes the properties panel./*from w w w . j a v a 2 s . c om*/ */ private void initPropertiesPanel() { propertiesPanel = new JPanel(); propertiesPanel.setLayout(new SpringLayout()); propertiesPanel.setBorder(BorderFactory.createTitledBorder("Properties")); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent ae) { handlePropertiesUpdate((Component) ae.getSource()); } }; FocusAdapter focusListener = new FocusAdapter() { public void focusLost(FocusEvent fe) { handlePropertiesUpdate(fe.getComponent()); } }; propertiesPanel.add(new JLabel("Sample rate: ")); sampleRateTextField = new JTextField(Double.toString(spectrumAnalyzerPanel.getSampleRate())); sampleRateTextField.addActionListener(actionListener); sampleRateTextField.addFocusListener(focusListener); propertiesPanel.add(sampleRateTextField); propertiesPanel.add(new JLabel("Number of points: ")); numberOfSamplesTextField = new JTextField(Integer.toString(spectrumAnalyzerPanel.getNumberOfSamples())); numberOfSamplesTextField.addActionListener(actionListener); numberOfSamplesTextField.addFocusListener(focusListener); propertiesPanel.add(numberOfSamplesTextField); propertiesPanel.add(new JLabel("Window: ")); Object[] windowTypes = EnumSet.allOf(WindowFunction.class).toArray(); windowFunctionComboBox = new JComboBox(windowTypes); windowFunctionComboBox.setSelectedItem(spectrumAnalyzerPanel.getWindowFunction()); windowFunctionComboBox.addActionListener(actionListener); propertiesPanel.add(windowFunctionComboBox); propertiesPanel.add(new JLabel("Size: ")); segmentSizeTextField = new JTextField(Integer.toString(spectrumAnalyzerPanel.getSegmentSize())); segmentSizeTextField.addActionListener(actionListener); segmentSizeTextField.addFocusListener(focusListener); propertiesPanel.add(segmentSizeTextField); propertiesPanel.add(new JLabel("Overlap: ")); overlapTextField = new JTextField(Integer.toString(spectrumAnalyzerPanel.getOverlap())); overlapTextField.addActionListener(actionListener); overlapTextField.addFocusListener(focusListener); propertiesPanel.add(overlapTextField); SpringUtilities.makeCompactGrid(propertiesPanel, 5, 2, 5, 5, 5, 5); panel.add(propertiesPanel, BorderLayout.EAST); }
From source file:pipeline.parameter_cell_views.IntRangeSlider.java
public IntRangeSlider() { super();/*from www . j a v a 2s. c o m*/ addMouseWheelListener(e -> { int rotation = e.getWheelRotation(); int change = (int) ((currentValue1 - currentValue0 + 1) * rotation * Utils.getMouseWheelClickFactor()); int newCurrentValue0 = currentValue0; int newCurrentValue1 = currentValue1; int saveIntMinimum = minimum; int saveIntMaximum = maximum; newCurrentValue0 += change; newCurrentValue1 += change; if (!((e.getModifiers() & java.awt.event.InputEvent.ALT_MASK) > 0)) { if (newCurrentValue1 > saveIntMaximum) { int difference = newCurrentValue1 - newCurrentValue0; newCurrentValue1 = saveIntMaximum; newCurrentValue0 = newCurrentValue1 - difference; if (newCurrentValue0 < 0) Utils.log("<0", LogLevel.WARNING); } if (newCurrentValue0 < saveIntMinimum) { int difference = newCurrentValue1 - newCurrentValue0; newCurrentValue0 = saveIntMinimum; newCurrentValue1 = newCurrentValue0 + difference; if (newCurrentValue0 < 0) Utils.log("<0", LogLevel.WARNING); } } else { } currentParameter .setValue(new int[] { newCurrentValue0, newCurrentValue1, saveIntMinimum, saveIntMaximum }); updateValues(); currentParameter.fireValueChanged(false, false, true); }); nf.setGroupingUsed(true); nf.setMaximumFractionDigits(3); nf.setMaximumIntegerDigits(12); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; parameterName = new JLabel(""); c.gridx = 0; c.gridy = 0; c.weighty = 1.0; c.weightx = 0.0; c.gridwidth = 4; add(Box.createRigidArea(new Dimension(0, 5)), c); slider = new RangeSlider(0, 20); slider.addChangeListener(new sliderListener()); c.gridx = 0; c.gridy = 1; c.weighty = 1.0; c.weightx = 0.0; c.gridwidth = 4; add(slider, c); c.gridwidth = 1; c.gridx = 0; c.gridy = 2; c.weighty = 1.0; c.weightx = 1.0; c.gridwidth = 4; Component comp = Box.createRigidArea(new Dimension(0, 10)); ((JComponent) comp).setOpaque(true); add(comp, c); c.gridwidth = 1; currentTextValue0 = new JTextField("" + slider.getValue()); currentTextValue1 = new JTextField("" + slider.getUpperValue()); currentTextValue0.addActionListener(new textBoxListenerTriggersUpdate()); currentTextValue1.addActionListener(new textBoxListenerTriggersUpdate()); Font smallerFont = new Font(currentTextValue0.getFont().getName(), currentTextValue0.getFont().getStyle(), currentTextValue0.getFont().getSize() - 2); textMinimum = new JTextField("0"); textMinimum.setFont(smallerFont); textMinimum.addActionListener(new minimumListener()); textMaximum = new JTextField("50"); textMaximum.setFont(smallerFont); textMaximum.addActionListener(new maximumListener()); textMaximum.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (!silenceUpdate) { slider.setMinimum(parseTextBox(textMinimum).intValue()); minimum = slider.getMinimum(); slider.setMaximum(parseTextBox(textMaximum).intValue()); maximum = slider.getMaximum(); slider.setValue(parseTextBox(currentTextValue0).intValue()); slider.setUpperValue(parseTextBox(currentTextValue1).intValue()); currentValue0 = slider.getValue(); currentValue1 = slider.getUpperValue(); currentParameter.setValue(new int[] { currentValue0, currentValue1, minimum, maximum }); } } }); textValueFrame = new JPanel(); textValueFrame.setBackground(getBackground()); textValueFrame.setLayout(new GridBagLayout()); c.gridx = 0; c.gridy = 0; c.weighty = 1.0; c.weightx = 0.1; textValueFrame.add(textMinimum, c); c.gridx = 1; c.gridy = 0; c.weighty = 1.0; c.weightx = 0.3; textValueFrame.add(currentTextValue0, c); c.gridx = 2; c.gridy = 0; c.weighty = 1.0; c.weightx = 0.3; textValueFrame.add(currentTextValue1, c); c.gridx = 3; c.gridy = 0; c.weighty = 1.0; c.weightx = 0.1; textValueFrame.add(textMaximum, c); c.gridx = 0; c.gridy = 3; c.weighty = 1.0; c.weightx = 0.3; c.gridwidth = 4; add(textValueFrame, c); c.gridwidth = 1; parameterName = new JLabel("parameter"); c.gridx = 0; c.gridy = 4; c.weighty = 1.0; c.weightx = 0.01; c.gridwidth = 1; add(parameterName, c); resetMin = new JButton("Min"); resetMin.setActionCommand("Reset Min"); resetMin.addActionListener(new buttonListener()); resetMax = new JButton("Max"); resetMax.setActionCommand("Reset Max"); resetMax.addActionListener(new buttonListener()); resetRange = new JButton("MinMax"); resetRange.setActionCommand("Reset Range"); resetRange.addActionListener(new buttonListener()); c.gridx = 1; c.gridy = 4; c.weighty = 1.0; c.weightx = 0.2; c.gridwidth = 1; add(resetMin, c); c.gridx = 2; c.gridy = 4; c.weighty = 1.0; c.weightx = 0.2; c.gridwidth = 1; add(resetMax, c); c.gridx = 3; c.gridy = 4; c.weighty = 1.0; c.weightx = 0.2; c.gridwidth = 1; add(resetRange, c); }
From source file:org.opendatakit.briefcase.ui.settings.SettingsPanelForm.java
private FocusListener onFocusLost(Runnable callback) { return new FocusAdapter() { @Override//from w w w .j a va 2 s.c o m public void focusLost(FocusEvent e) { super.focusLost(e); callback.run(); } }; }
From source file:op.care.med.inventory.DlgCloseStock.java
/** * This method is called from within the constructor to * initialize the form./* w ww .j a v a 2s . c om*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new JPanel(); jScrollPane1 = new JScrollPane(); txtInfo = new JTextPane(); rbLeer = new JRadioButton(); rbStellen = new JRadioButton(); txtLetzte = new JTextField(); lblEinheiten = new JLabel(); rbAbgelaufen = new JRadioButton(); jSeparator1 = new JSeparator(); jLabel2 = new JLabel(); jLabel3 = new JLabel(); rbGefallen = new JRadioButton(); cmbBestID = new JComboBox(); panel1 = new JPanel(); btnClose = new JButton(); btnOk = new JButton(); //======== this ======== setResizable(false); setModalityType(Dialog.ModalityType.APPLICATION_MODAL); Container contentPane = getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); //======== jPanel1 ======== { jPanel1.setBorder(null); jPanel1.setLayout(new FormLayout("14dlu, $lcgap, 145dlu, $lcgap, 41dlu, $lcgap, 93dlu, $lcgap, 14dlu", "14dlu, $lgap, fill:70dlu:grow, 4*($lgap, fill:default), $lgap, $rgap, $lgap, fill:default, $lgap, $rgap, $lgap, default, $lgap, 14dlu")); //======== jScrollPane1 ======== { //---- txtInfo ---- txtInfo.setEditable(false); txtInfo.setFont(new Font("Arial", Font.PLAIN, 14)); jScrollPane1.setViewportView(txtInfo); } jPanel1.add(jScrollPane1, CC.xywh(3, 3, 5, 1)); //---- rbLeer ---- rbLeer.setSelected(true); rbLeer.setText("Die Packung ist nun leer"); rbLeer.setFont(new Font("Arial", Font.PLAIN, 14)); rbLeer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rbLeerActionPerformed(e); } }); jPanel1.add(rbLeer, CC.xy(3, 5)); //---- rbStellen ---- rbStellen.setText("Beim Vorab Stellen haben Sie die letzten "); rbStellen.setFont(new Font("Arial", Font.PLAIN, 14)); rbStellen.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rbStellenActionPerformed(e); } }); jPanel1.add(rbStellen, CC.xywh(3, 7, 2, 1)); //---- txtLetzte ---- txtLetzte.setText("jTextField1"); txtLetzte.setFont(new Font("Arial", Font.PLAIN, 14)); txtLetzte.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { txtLetzteFocusLost(e); } }); jPanel1.add(txtLetzte, CC.xy(5, 7)); //---- lblEinheiten ---- lblEinheiten.setText("Einheiten verbraucht."); lblEinheiten.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(lblEinheiten, CC.xy(7, 7)); //---- rbAbgelaufen ---- rbAbgelaufen.setText( "Die Packung ist abgelaufen oder wird nicht mehr ben\u00f6tigt. Bereit zur Entsorgung."); rbAbgelaufen.setFont(new Font("Arial", Font.PLAIN, 14)); rbAbgelaufen.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rbAbgelaufenActionPerformed(e); } }); jPanel1.add(rbAbgelaufen, CC.xywh(3, 9, 5, 1)); jPanel1.add(jSeparator1, CC.xywh(3, 13, 5, 1)); //---- jLabel2 ---- jLabel2.setText("Als n\u00e4chstes Packung soll die Nummer"); jLabel2.setFont(new Font("Arial", Font.PLAIN, 14)); jLabel2.setHorizontalAlignment(SwingConstants.TRAILING); jPanel1.add(jLabel2, CC.xy(3, 15)); //---- jLabel3 ---- jLabel3.setText("angebrochen werden."); jLabel3.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(jLabel3, CC.xy(7, 15)); //---- rbGefallen ---- rbGefallen.setText( "<html>Die Packung ist <font color=\"red\">runter gefallen</font> oder <font color=\"red\">verschwunden</font> und muss ausgebucht werden.</html>"); rbGefallen.setFont(new Font("Arial", Font.PLAIN, 14)); rbGefallen.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rbGefallenActionPerformed(e); } }); jPanel1.add(rbGefallen, CC.xywh(3, 11, 5, 1)); //---- cmbBestID ---- cmbBestID.setModel(new DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbBestID.setFont(new Font("Arial", Font.PLAIN, 14)); cmbBestID.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cmbBestIDItemStateChanged(e); } }); jPanel1.add(cmbBestID, CC.xy(5, 15)); //======== panel1 ======== { panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS)); //---- btnClose ---- btnClose.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png"))); btnClose.setText(null); btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnCloseActionPerformed(e); } }); panel1.add(btnClose); //---- btnOk ---- btnOk.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png"))); btnOk.setText(null); btnOk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnOkActionPerformed(e); } }); panel1.add(btnOk); } jPanel1.add(panel1, CC.xy(7, 19, CC.RIGHT, CC.DEFAULT)); } contentPane.add(jPanel1); pack(); setLocationRelativeTo(getOwner()); //---- buttonGroup1 ---- ButtonGroup buttonGroup1 = new ButtonGroup(); buttonGroup1.add(rbLeer); buttonGroup1.add(rbStellen); buttonGroup1.add(rbAbgelaufen); buttonGroup1.add(rbGefallen); }
From source file:op.system.DlgLogin.java
/** * This method is called from within the constructor to * initialize the printerForm.//w w w .j a v a 2s. c o m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel2 = new JPanel(); lblOPDE = new JLabel(); btnAbout = new JButton(); lblUsernamePassword = new JLabel(); txtUsername = new JTextField(); txtPassword = new JPasswordField(); panel1 = new JPanel(); btnExit = new JButton(); hSpacer1 = new JPanel(null); btnLogin = new JButton(); //======== this ======== setModalityType(Dialog.ModalityType.APPLICATION_MODAL); setResizable(false); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { thisWindowActivated(e); } }); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("13dlu, default, 13dlu", "13dlu, $lgap, fill:48dlu:grow, $lgap, default, $lgap, 13dlu")); //======== jPanel2 ======== { jPanel2.setBorder(new EmptyBorder(5, 5, 5, 5)); jPanel2.setOpaque(false); jPanel2.setLayout(new VerticalLayout(10)); //---- lblOPDE ---- lblOPDE.setText("Offene-Pflege.de"); lblOPDE.setFont(new Font("Arial", Font.PLAIN, 24)); lblOPDE.setHorizontalAlignment(SwingConstants.CENTER); jPanel2.add(lblOPDE); //---- btnAbout ---- btnAbout.setIcon(new ImageIcon(getClass().getResource("/artwork/256x256/opde-logo.png"))); btnAbout.setBorderPainted(false); btnAbout.setBorder(null); btnAbout.setOpaque(false); btnAbout.setContentAreaFilled(false); btnAbout.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAbout.setToolTipText(null); btnAbout.addActionListener(e -> btnAboutActionPerformed(e)); jPanel2.add(btnAbout); //---- lblUsernamePassword ---- lblUsernamePassword.setText("text"); lblUsernamePassword.setFont(new Font("Arial", Font.PLAIN, 18)); jPanel2.add(lblUsernamePassword); //---- txtUsername ---- txtUsername.setFont(new Font("Arial", Font.PLAIN, 18)); txtUsername.addActionListener(e -> txtUsernameActionPerformed(e)); txtUsername.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtUsernameFocusGained(e); } }); jPanel2.add(txtUsername); //---- txtPassword ---- txtPassword.setFont(new Font("Arial", Font.PLAIN, 18)); txtPassword.addActionListener(e -> txtPasswordActionPerformed(e)); txtPassword.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtPasswordFocusGained(e); } }); jPanel2.add(txtPassword); } contentPane.add(jPanel2, CC.xy(2, 3, CC.FILL, CC.DEFAULT)); //======== panel1 ======== { panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS)); //---- btnExit ---- btnExit.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/exit.png"))); btnExit.addActionListener(e -> btnExitActionPerformed(e)); panel1.add(btnExit); panel1.add(hSpacer1); //---- btnLogin ---- btnLogin.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png"))); btnLogin.setActionCommand("btnLogin"); btnLogin.addActionListener(e -> DoLogin(e)); panel1.add(btnLogin); } contentPane.add(panel1, CC.xy(2, 5, CC.RIGHT, CC.DEFAULT)); setSize(320, 540); setLocationRelativeTo(getOwner()); }