List of usage examples for javax.swing ButtonGroup ButtonGroup
public ButtonGroup()
ButtonGroup
. From source file:ome.formats.importer.gui.OptionsDialog.java
/** * Initialize and show the options dialog * //from ww w . j a v a2s . com * @param config - ImportConfig to store/save settings too * @param owner - parent * @param title - dialog title * @param modal - modal yes/no */ OptionsDialog(ImportConfig config, JFrame owner, String title, boolean modal) { super(owner); this.owner = owner; setLocation(200, 200); setTitle(title); setModal(modal); setResizable(false); setSize(new Dimension(dialogWidth, dialogHeight)); setLocationRelativeTo(owner); tabbedPane = new JTabbedPane(); tabbedPane.setOpaque(false); // content panes must be opaque this.config = config; oldQuaquaLevel = config.getUseQuaqua(); oldUserDisableHistory = config.getUserDisableHistory(); /////////////////////// START MAIN PANEL //////////////////////// // Set up the main pane double mainPanelTable[][] = { { TableLayout.FILL, 120, 5, 120, TableLayout.FILL }, // columns { TableLayout.FILL, 5, 30 } }; // rows mainPanel = GuiCommonElements.addMainPanel(this, mainPanelTable, 10, 10, 10, 10, debug); // Buttons at the bottom of the form cancelBtn = GuiCommonElements.addButton(mainPanel, "Cancel", 'L', "Cancel", "1, 2, f, c", debug); cancelBtn.addActionListener(this); okBtn = GuiCommonElements.addButton(mainPanel, "OK", 'Q', "Import", "3, 2, f, c", debug); okBtn.addActionListener(this); this.getRootPane().setDefaultButton(okBtn); GuiCommonElements.enterPressesWhenFocused(okBtn); mainPanel.add(tabbedPane, "0,0,4,0"); /////////////////////// START DEBUG OPTIONS PANEL //////////////////////// double debugOptionTable[][] = { { TableLayout.FILL }, // columns { 10, TableLayout.PREFERRED, 20, 30, 15, TableLayout.FILL } }; // rows debugOptionsPanel = GuiCommonElements.addMainPanel(tabbedPane, debugOptionTable, 0, 10, 10, 10, debug); String message = "Choose the level of detail for your log file's data."; GuiCommonElements.addTextPane(debugOptionsPanel, message, "0, 1, 0, 0", debug); dBox = GuiCommonElements.addComboBox(debugOptionsPanel, "Debug Level: ", debugItems, 'D', "Choose the level of detail for your log file's data.", 95, "0,3,F,C", debug); int debugLevel = config.getDebugLevel(); for (int i = 0; i < dBox.getItemCount(); i++) { if (((DebugItem) dBox.getItemAt(i)).getLevel() == debugLevel) dBox.setSelectedIndex(i); } dBox.addActionListener(this); String description = ((DebugItem) dBox.getSelectedItem()).getDescription(); descriptionText = GuiCommonElements.addTextPane(debugOptionsPanel, description, "0, 5", debug); final Font textFieldFont = (Font) UIManager.get("TextField.font"); final Font font = new Font(textFieldFont.getFamily(), Font.ITALIC, textFieldFont.getSize()); descriptionText.setFont(font); /////////////////////// START OTHER OPTIONS PANEL //////////////////////// double otherOptionTable[][] = { { TableLayout.FILL }, // columns { 10, TableLayout.PREFERRED, 20, 30, 15, TableLayout.FILL } }; // rows otherOptionsPanel = GuiCommonElements.addMainPanel(tabbedPane, otherOptionTable, 0, 10, 10, 10, debug); companionFileCheckbox = GuiCommonElements.addCheckBox(otherOptionsPanel, "<html>Attached a text file to each imported" + " file containing all collected metadata.</html>", "0,1", debug); companionFileCheckbox.setSelected(config.companionFile.get()); disableHistoryCheckbox = GuiCommonElements.addCheckBox(otherOptionsPanel, "<html>Disable Import History. (Improves " + " import speed. Restart required if changed).</html>", "0,3", debug); disableHistoryCheckbox.setSelected(config.getUserDisableHistory()); // If disabled by admin in import.config, disable this option if (config.getStaticDisableHistory()) { disableHistoryCheckbox.setEnabled(false); } /////////////////////// START FILECHOOSER PANEL //////////////////////// // Set up the import panel for tPane, quit, and send buttons double fileChooserTable[][] = { { TableLayout.FILL, 120, 5, 120, TableLayout.FILL }, // columns { TableLayout.PREFERRED, 15, TableLayout.FILL, 10 } }; // rows fileChooserPanel = GuiCommonElements.addMainPanel(tabbedPane, fileChooserTable, 0, 10, 0, 10, debug); message = "Switch between single pane view and triple pane view. " + "You will need to reboot the importer before your changes will take effect."; GuiCommonElements.addTextPane(fileChooserPanel, message, "0, 0, 4, 0", debug); // Set up single pane table double singlePaneTable[][] = { { 24, 5, TableLayout.FILL }, // columns { TableLayout.FILL } }; // rows // Panel containing the single pane layout singlePanePanel = GuiCommonElements.addMainPanel(fileChooserPanel, singlePaneTable, 0, 0, 0, 0, debug); singlePaneBtn = GuiCommonElements.addRadioButton(singlePanePanel, null, 'u', null, "0,0", debug); GuiCommonElements.addImagePanel(singlePanePanel, SINGLE_PANE_IMAGE, "2,0", debug); fileChooserPanel.add(singlePanePanel, "0, 2, 1, 2"); // Set up triple pane table double triplePaneTable[][] = { { 24, 5, TableLayout.FILL }, // columns { TableLayout.FILL } }; // rows // Panel containing the triple pane layout triplePanePanel = GuiCommonElements.addMainPanel(fileChooserPanel, triplePaneTable, 0, 0, 0, 0, debug); triplePaneBtn = GuiCommonElements.addRadioButton(triplePanePanel, null, 'u', null, "0,0", debug); GuiCommonElements.addImagePanel(triplePanePanel, TRIPLE_PANE_IMAGE, "2,0", debug); fileChooserPanel.add(triplePanePanel, "3, 2, 4, 2"); ButtonGroup group = new ButtonGroup(); group.add(singlePaneBtn); group.add(triplePaneBtn); if (config.getUseQuaqua() == true) { triplePaneBtn.setSelected(true); singlePaneBtn.setSelected(false); } else { triplePaneBtn.setSelected(false); singlePaneBtn.setSelected(true); } /////////////////////// START TABBED PANE //////////////////////// //if (GuiCommonElements.getIsMac()) tabbedPane.addTab("FileChooser", null, fileChooserPanel, "FileChooser Settings"); tabbedPane.addTab("Debug", null, debugOptionsPanel, "Debug Settings"); tabbedPane.addTab("Other", null, otherOptionsPanel, "Other Settings"); this.add(mainPanel); setVisible(true); }
From source file:op.care.med.inventory.DlgCloseStock.java
/** * This method is called from within the constructor to * initialize the form./*www.j av a 2 s .c o m*/ * 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.care.prescription.DlgOnDemand.java
/** * This method is called from within the constructor to * initialize the form.//from w ww . j av a 2 s . 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() { jPanel1 = new JPanel(); txtMed = new JXSearchField(); cmbMed = new JComboBox<>(); panel4 = new JPanel(); btnMedWizard = new JButton(); cmbIntervention = new JComboBox<>(); txtSit = new JXSearchField(); cmbSit = new JComboBox<>(); panel3 = new JPanel(); btnAddSit = new JButton(); txtIntervention = new JXSearchField(); jPanel2 = new JPanel(); lblNumber = new JLabel(); lblDose = new JLabel(); lblMaxPerDay = new JLabel(); txtMaxTimes = new JTextField(); lblX = new JLabel(); txtEDosis = new JTextField(); lblCheckResultAfter = new JLabel(); cmbCheckAfter = new JComboBox<>(); jPanel3 = new JPanel(); pnlOFF = new JPanel(); rbActive = new JRadioButton(); rbDate = new JRadioButton(); txtOFF = new JTextField(); jScrollPane3 = new JScrollPane(); txtBemerkung = new JTextPane(); lblText = new JLabel(); pnlON = new JPanel(); cmbDocON = new JComboBox<>(); cmbHospitalON = new JComboBox<>(); panel1 = new JPanel(); btnClose = new JButton(); btnSave = new JButton(); //======== this ======== setModalityType(Dialog.ModalityType.APPLICATION_MODAL); setResizable(false); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("14dlu, $lcgap, default, 6dlu, 355dlu, $lcgap, 14dlu", "14dlu, $lgap, fill:default:grow, $lgap, fill:default, $lgap, 14dlu")); //======== jPanel1 ======== { jPanel1.setBorder(null); jPanel1.setLayout(new FormLayout("68dlu, $lcgap, pref:grow, $lcgap, pref", "3*(16dlu, $lgap), default, $lgap, fill:113dlu:grow, $lgap, 60dlu")); //---- txtMed ---- txtMed.setFont(new Font("Arial", Font.PLAIN, 14)); txtMed.setPrompt("Medikamente"); txtMed.setFocusBehavior(PromptSupport.FocusBehavior.HIGHLIGHT_PROMPT); txtMed.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtMedActionPerformed(e); } }); txtMed.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtMedFocusGained(e); } }); jPanel1.add(txtMed, CC.xy(1, 1)); //---- cmbMed ---- cmbMed.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbMed.setFont(new Font("Arial", Font.PLAIN, 14)); cmbMed.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cmbMedItemStateChanged(e); } }); jPanel1.add(cmbMed, CC.xy(3, 1)); //======== panel4 ======== { panel4.setLayout(new BoxLayout(panel4, BoxLayout.LINE_AXIS)); //---- btnMedWizard ---- btnMedWizard.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnMedWizard.setBorderPainted(false); btnMedWizard.setBorder(null); btnMedWizard.setContentAreaFilled(false); btnMedWizard.setToolTipText("Neues Medikament eintragen"); btnMedWizard.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnMedWizard.setSelectedIcon( new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnMedWizard.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnMedActionPerformed(e); } }); panel4.add(btnMedWizard); } jPanel1.add(panel4, CC.xy(5, 1)); //---- cmbIntervention ---- cmbIntervention .setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbIntervention.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(cmbIntervention, CC.xywh(3, 5, 3, 1)); //---- txtSit ---- txtSit.setPrompt("Situationen"); txtSit.setFont(new Font("Arial", Font.PLAIN, 14)); txtSit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtSitActionPerformed(e); } }); jPanel1.add(txtSit, CC.xy(1, 3)); //---- cmbSit ---- cmbSit.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbSit.setFont(new Font("Arial", Font.PLAIN, 14)); cmbSit.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cmbSitItemStateChanged(e); } }); cmbSit.addPropertyChangeListener("model", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { cmbSitPropertyChange(e); } }); jPanel1.add(cmbSit, CC.xy(3, 3)); //======== panel3 ======== { panel3.setLayout(new BoxLayout(panel3, BoxLayout.LINE_AXIS)); //---- btnAddSit ---- btnAddSit.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAddSit.setBorderPainted(false); btnAddSit.setBorder(null); btnAddSit.setContentAreaFilled(false); btnAddSit.setToolTipText("Neue Situation eintragen"); btnAddSit.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAddSit.setSelectedIcon( new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnAddSit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnSituationActionPerformed(e); } }); panel3.add(btnAddSit); } jPanel1.add(panel3, CC.xy(5, 3, CC.RIGHT, CC.DEFAULT)); //---- txtIntervention ---- txtIntervention.setFont(new Font("Arial", Font.PLAIN, 14)); txtIntervention.setPrompt("Massnahmen"); txtIntervention.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtMassActionPerformed(e); } }); jPanel1.add(txtIntervention, CC.xy(1, 5)); //======== jPanel2 ======== { jPanel2.setLayout(new FormLayout("default, $lcgap, pref, $lcgap, default, $lcgap, 37dlu:grow", "23dlu, fill:22dlu, $ugap, default")); //---- lblNumber ---- lblNumber.setText("Anzahl"); jPanel2.add(lblNumber, CC.xy(3, 1)); //---- lblDose ---- lblDose.setText("Dosis"); jPanel2.add(lblDose, CC.xy(7, 1, CC.CENTER, CC.DEFAULT)); //---- lblMaxPerDay ---- lblMaxPerDay.setText("Max. Tagesdosis:"); jPanel2.add(lblMaxPerDay, CC.xy(1, 2)); //---- txtMaxTimes ---- txtMaxTimes.setHorizontalAlignment(SwingConstants.CENTER); txtMaxTimes.setText("1"); txtMaxTimes.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtMaxTimesActionPerformed(e); } }); txtMaxTimes.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtMaxTimesFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtMaxTimesFocusLost(e); } }); jPanel2.add(txtMaxTimes, CC.xy(3, 2)); //---- lblX ---- lblX.setText("x"); jPanel2.add(lblX, CC.xy(5, 2)); //---- txtEDosis ---- txtEDosis.setHorizontalAlignment(SwingConstants.CENTER); txtEDosis.setText("1.0"); txtEDosis.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtEDosisFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtEDosisFocusLost(e); } }); txtEDosis.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtEDosisActionPerformed(e); } }); jPanel2.add(txtEDosis, CC.xy(7, 2)); //---- lblCheckResultAfter ---- lblCheckResultAfter.setText("Nachkontrolle:"); jPanel2.add(lblCheckResultAfter, CC.xy(1, 4)); //---- cmbCheckAfter ---- cmbCheckAfter.setModel(new DefaultComboBoxModel<>(new String[] { "keine Nachkontrolle", "nach 1 Stunde", "nach 2 Stunden", "nach 3 Stunden" })); jPanel2.add(cmbCheckAfter, CC.xywh(3, 4, 5, 1)); } jPanel1.add(jPanel2, CC.xywh(1, 9, 5, 1, CC.CENTER, CC.TOP)); } contentPane.add(jPanel1, CC.xy(5, 3)); //======== jPanel3 ======== { jPanel3.setBorder(null); jPanel3.setLayout(new FormLayout("149dlu", "3*(fill:default, $lgap), fill:100dlu:grow")); //======== pnlOFF ======== { pnlOFF.setBorder(new TitledBorder("Absetzung")); pnlOFF.setLayout(new FormLayout("pref, 86dlu:grow", "fill:17dlu, $lgap, fill:17dlu")); //---- rbActive ---- rbActive.setText("text"); rbActive.setSelected(true); rbActive.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { rbActiveItemStateChanged(e); } }); pnlOFF.add(rbActive, CC.xywh(1, 1, 2, 1)); //---- rbDate ---- rbDate.setText(null); rbDate.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { rbDateItemStateChanged(e); } }); pnlOFF.add(rbDate, CC.xy(1, 3)); //---- txtOFF ---- txtOFF.setEnabled(false); txtOFF.setFont(new Font("Arial", Font.PLAIN, 14)); txtOFF.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { txtOFFFocusLost(e); } }); pnlOFF.add(txtOFF, CC.xy(2, 3)); } jPanel3.add(pnlOFF, CC.xy(1, 3)); //======== jScrollPane3 ======== { //---- txtBemerkung ---- txtBemerkung.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { txtBemerkungCaretUpdate(e); } }); jScrollPane3.setViewportView(txtBemerkung); } jPanel3.add(jScrollPane3, CC.xy(1, 7)); //---- lblText ---- lblText.setText("Bemerkung:"); jPanel3.add(lblText, CC.xy(1, 5)); //======== pnlON ======== { pnlON.setBorder(new TitledBorder("Ansetzung")); pnlON.setLayout(new FormLayout("119dlu:grow", "17dlu, $lgap, fill:17dlu")); //---- cmbDocON ---- cmbDocON.setModel( new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbDocON.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { cmbDocONKeyPressed(e); } }); pnlON.add(cmbDocON, CC.xy(1, 1)); //---- cmbHospitalON ---- cmbHospitalON.setModel( new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); pnlON.add(cmbHospitalON, CC.xy(1, 3)); } jPanel3.add(pnlON, CC.xy(1, 1)); } contentPane.add(jPanel3, CC.xy(3, 3)); //======== panel1 ======== { panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS)); //---- btnClose ---- btnClose.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png"))); btnClose.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnCloseActionPerformed(e); } }); panel1.add(btnClose); //---- btnSave ---- btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png"))); btnSave.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnSave.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnSaveActionPerformed(e); } }); panel1.add(btnSave); } contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT)); setSize(1035, 515); setLocationRelativeTo(getOwner()); //---- bgMedikament ---- ButtonGroup bgMedikament = new ButtonGroup(); bgMedikament.add(rbActive); bgMedikament.add(rbDate); }
From source file:op.care.prescription.DlgRegular.java
/** * This method is called from within the constructor to * initialize the form./*from w w w . j ava2s.com*/ * 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() { jPanel1 = new JPanel(); txtMed = new JXSearchField(); cmbMed = new JComboBox<>(); panel4 = new JPanel(); btnMed = new JButton(); cmbIntervention = new JComboBox<>(); txtIntervention = new JXSearchField(); jPanel8 = new JPanel(); jspDosis = new JScrollPane(); tblDosis = new JTable(); panel2 = new JPanel(); btnAddDosis = new JButton(); jPanel3 = new JPanel(); pnlOFF = new JPanel(); rbActive = new JRadioButton(); rbDate = new JRadioButton(); txtTo = new JTextField(); rbEndOfPackage = new JRadioButton(); jScrollPane3 = new JScrollPane(); txtBemerkung = new JTextPane(); lblText = new JLabel(); pnlON = new JPanel(); cmbDocON = new JComboBox<>(); btnAddGP = new JButton(); cmbHospitalON = new JComboBox<>(); btnAddHospital = new JButton(); panel1 = new JPanel(); btnClose = new JButton(); btnSave = new JButton(); lblTX = new JLabel(); //======== this ======== setModalityType(Dialog.ModalityType.APPLICATION_MODAL); setResizable(false); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("$rgap, $lcgap, default, $lcgap, pref, $lcgap, $rgap", "$rgap, $lgap, fill:default:grow, $lgap, fill:default, $lgap, $rgap")); //======== jPanel1 ======== { jPanel1.setBorder(null); jPanel1.setLayout(new FormLayout("68dlu, $lcgap, 284dlu, $lcgap, pref", "2*(16dlu, $lgap), default, $lgap, fill:default:grow")); //---- txtMed ---- txtMed.setFont(new Font("Arial", Font.PLAIN, 14)); txtMed.setPrompt("Medikamente"); txtMed.setFocusBehavior(PromptSupport.FocusBehavior.HIGHLIGHT_PROMPT); txtMed.addActionListener(e -> txtMedActionPerformed(e)); txtMed.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtMedFocusGained(e); } }); jPanel1.add(txtMed, CC.xy(1, 1)); //---- cmbMed ---- cmbMed.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbMed.setFont(new Font("Arial", Font.PLAIN, 14)); cmbMed.addItemListener(e -> cmbMedItemStateChanged(e)); jPanel1.add(cmbMed, CC.xy(3, 1)); //======== panel4 ======== { panel4.setLayout(new BoxLayout(panel4, BoxLayout.LINE_AXIS)); //---- btnMed ---- btnMed.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnMed.setBorderPainted(false); btnMed.setBorder(null); btnMed.setContentAreaFilled(false); btnMed.setToolTipText("Neues Medikament eintragen"); btnMed.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnMed.setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnMed.addActionListener(e -> btnMedActionPerformed(e)); panel4.add(btnMed); } jPanel1.add(panel4, CC.xy(5, 1)); //---- cmbIntervention ---- cmbIntervention .setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbIntervention.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(cmbIntervention, CC.xywh(3, 3, 3, 1)); //---- txtIntervention ---- txtIntervention.setFont(new Font("Arial", Font.PLAIN, 14)); txtIntervention.setPrompt("Massnahmen"); txtIntervention.addActionListener(e -> txtMassActionPerformed(e)); jPanel1.add(txtIntervention, CC.xy(1, 3)); //======== jPanel8 ======== { jPanel8.setBorder(new TitledBorder(null, "Dosis / H\u00e4ufigkeit", TitledBorder.LEADING, TitledBorder.DEFAULT_POSITION, new Font("Arial", Font.PLAIN, 14))); jPanel8.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel8.setLayout(new FormLayout("370dlu", "fill:default:grow, $lgap, pref")); //======== jspDosis ======== { jspDosis.setToolTipText(null); //---- tblDosis ---- tblDosis.setModel(new DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); tblDosis.setSurrendersFocusOnKeystroke(true); tblDosis.setToolTipText(null); tblDosis.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { tblDosisMousePressed(e); } }); jspDosis.setViewportView(tblDosis); } jPanel8.add(jspDosis, CC.xy(1, 1)); //======== panel2 ======== { panel2.setLayout(new BoxLayout(panel2, BoxLayout.LINE_AXIS)); //---- btnAddDosis ---- btnAddDosis.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAddDosis.setBorderPainted(false); btnAddDosis.setBorder(null); btnAddDosis.setContentAreaFilled(false); btnAddDosis.setToolTipText("Neue Dosierung eintragen"); btnAddDosis.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAddDosis.setSelectedIcon( new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnAddDosis.addActionListener(e -> btnAddDosisActionPerformed(e)); panel2.add(btnAddDosis); } jPanel8.add(panel2, CC.xy(1, 3, CC.LEFT, CC.DEFAULT)); } jPanel1.add(jPanel8, CC.xywh(1, 7, 5, 1)); } contentPane.add(jPanel1, CC.xy(5, 3)); //======== jPanel3 ======== { jPanel3.setBorder(null); jPanel3.setLayout(new FormLayout("149dlu", "3*(fill:default, $lgap), fill:108dlu:grow, $lgap, 60dlu")); //======== pnlOFF ======== { pnlOFF.setBorder(new TitledBorder("Absetzung")); pnlOFF.setLayout(new FormLayout("pref, 86dlu:grow", "2*(fill:17dlu, $lgap), fill:17dlu")); //---- rbActive ---- rbActive.setText("text"); rbActive.setSelected(true); rbActive.addItemListener(e -> rbActiveItemStateChanged(e)); pnlOFF.add(rbActive, CC.xywh(1, 1, 2, 1)); //---- rbDate ---- rbDate.setText(null); rbDate.addItemListener(e -> rbDateItemStateChanged(e)); pnlOFF.add(rbDate, CC.xy(1, 3)); //---- txtTo ---- txtTo.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { txtToFocusLost(e); } }); pnlOFF.add(txtTo, CC.xy(2, 3)); //---- rbEndOfPackage ---- rbEndOfPackage.setText("text"); rbEndOfPackage.addItemListener(e -> rbEndOfPackageItemStateChanged(e)); pnlOFF.add(rbEndOfPackage, CC.xywh(1, 5, 2, 1)); } jPanel3.add(pnlOFF, CC.xy(1, 3)); //======== jScrollPane3 ======== { //---- txtBemerkung ---- txtBemerkung.addCaretListener(e -> txtBemerkungCaretUpdate(e)); jScrollPane3.setViewportView(txtBemerkung); } jPanel3.add(jScrollPane3, CC.xy(1, 7)); //---- lblText ---- lblText.setText("Bemerkung:"); jPanel3.add(lblText, CC.xy(1, 5)); //======== pnlON ======== { pnlON.setBorder(new TitledBorder("Ansetzung")); pnlON.setLayout(new FormLayout("119dlu:grow, $lcgap, default", "default, $lgap, default")); //---- cmbDocON ---- cmbDocON.setModel( new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbDocON.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { cmbDocONKeyPressed(e); } }); pnlON.add(cmbDocON, CC.xy(1, 1)); //---- btnAddGP ---- btnAddGP.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAddGP.setBorderPainted(false); btnAddGP.setBorder(null); btnAddGP.setContentAreaFilled(false); btnAddGP.setToolTipText("Neues Medikament eintragen"); btnAddGP.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAddGP.setSelectedIcon( new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnAddGP.addActionListener(e -> btnAddGPActionPerformed(e)); pnlON.add(btnAddGP, CC.xy(3, 1)); //---- cmbHospitalON ---- cmbHospitalON.setModel( new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); pnlON.add(cmbHospitalON, CC.xy(1, 3)); //---- btnAddHospital ---- btnAddHospital.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAddHospital.setBorderPainted(false); btnAddHospital.setBorder(null); btnAddHospital.setContentAreaFilled(false); btnAddHospital.setToolTipText("Neues Medikament eintragen"); btnAddHospital.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAddHospital.setSelectedIcon( new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnAddHospital.addActionListener(e -> btnAddHospitalActionPerformed(e)); pnlON.add(btnAddHospital, CC.xy(3, 3)); } jPanel3.add(pnlON, CC.xy(1, 1)); } contentPane.add(jPanel3, CC.xy(3, 3)); //======== panel1 ======== { panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS)); //---- btnClose ---- btnClose.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png"))); btnClose.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnClose.addActionListener(e -> btnCloseActionPerformed(e)); panel1.add(btnClose); //---- btnSave ---- btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png"))); btnSave.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnSave.addActionListener(e -> btnSaveActionPerformed(e)); panel1.add(btnSave); } contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT)); //---- lblTX ---- lblTX.setText(null); lblTX.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/ambulance2.png"))); contentPane.add(lblTX, CC.xy(3, 5)); setSize(1015, 640); setLocationRelativeTo(getOwner()); //---- bgMedikament ---- ButtonGroup bgMedikament = new ButtonGroup(); bgMedikament.add(rbActive); bgMedikament.add(rbDate); bgMedikament.add(rbEndOfPackage); }
From source file:op.controlling.PnlQMSSchedule.java
/** * This method is called from within the constructor to * initialize the form.//from w w w . j a v a 2 s . co 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() { panelMain = new JPanel(); lblMeasure = new JLabel(); txtQMS = new JTextField(); lblLocation = new JLabel(); cmbLocation = new TreeComboBox(); tabWdh = new JideTabbedPane(); pnlDaily = new JPanel(); lblEveryDay = new JLabel(); spinTaeglich = new JSpinner(); lblDays = new JLabel(); btnJedenTag = new JButton(); pnlWeekly = new JPanel(); panel3 = new JPanel(); btnJedeWoche = new JButton(); lblEveryWeek = new JLabel(); spinWoche = new JSpinner(); lblWeeks = new JLabel(); lblUhrzeit2 = new JideLabel(); lblUhrzeit3 = new JideLabel(); lblUhrzeit4 = new JideLabel(); lblUhrzeit5 = new JideLabel(); lblUhrzeit6 = new JideLabel(); lblUhrzeit7 = new JideLabel(); lblUhrzeit8 = new JideLabel(); cbMon = new JRadioButton(); cbDie = new JRadioButton(); cbMit = new JRadioButton(); cbDon = new JRadioButton(); cbFre = new JRadioButton(); cbSam = new JRadioButton(); cbSon = new JRadioButton(); pnlMonthly = new JPanel(); lblEveryMonth = new JLabel(); spinMonat = new JSpinner(); lblMonth = new JLabel(); btnJedenMonat = new JButton(); llblOnDayOfMonth = new JLabel(); spinDayInMonth = new JSpinner(); cmbTag = new JComboBox<>(); pnlYearly = new JPanel(); lblEveryYear = new JLabel(); spinYearly = new JSpinner(); lblYear = new JLabel(); btnEveryYear = new JButton(); lblOnDay = new JLabel(); spinDayInMonthInYear = new JSpinner(); cmbMonth = new JComboBox(); lblLDate = new JLabel(); jdcStartingOn = new JDateChooser(); jScrollPane1 = new JScrollPane(); txtBemerkung = new JTextArea(); btnSave = new JButton(); lblDueDays = new JLabel(); txtDueDays = GUITools.createIntegerTextField(1, 31, 1); //======== this ======== setLayout(new BorderLayout()); //======== panelMain ======== { panelMain.setBorder(new LineBorder(Color.black, 2, true)); panelMain.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { panelMainComponentResized(e); } }); panelMain.setLayout(new FormLayout("$rgap, $lcgap, 35dlu:grow, $ugap, 105dlu:grow, $lcgap, $rgap", "default, $nlgap, 18dlu, $lgap, default, $nlgap, 2*(default, $lgap), pref, $lgap, default, $nlgap, default, $lgap, 72dlu:grow, $lgap, default, $lgap, $rgap")); //---- lblMeasure ---- lblMeasure.setText("text"); lblMeasure.setFont(new Font("Arial", Font.PLAIN, 10)); lblMeasure.setHorizontalAlignment(SwingConstants.TRAILING); panelMain.add(lblMeasure, CC.xy(5, 1)); //---- txtQMS ---- txtQMS.setFont(new Font("Arial", Font.BOLD, 14)); panelMain.add(txtQMS, CC.xywh(3, 3, 3, 1, CC.DEFAULT, CC.FILL)); //---- lblLocation ---- lblLocation.setText("text"); lblLocation.setFont(new Font("Arial", Font.PLAIN, 10)); lblLocation.setHorizontalAlignment(SwingConstants.TRAILING); panelMain.add(lblLocation, CC.xy(5, 5)); panelMain.add(cmbLocation, CC.xy(5, 7)); //======== tabWdh ======== { //======== pnlDaily ======== { pnlDaily.setFont(new Font("Arial", Font.PLAIN, 14)); pnlDaily.setLayout(new FormLayout("2*(default), $rgap, $lcgap, 40dlu, $rgap, default", "default, $lgap, pref, $lgap, default")); //---- lblEveryDay ---- lblEveryDay.setText("alle"); lblEveryDay.setFont(new Font("Arial", Font.PLAIN, 14)); pnlDaily.add(lblEveryDay, CC.xy(2, 3)); //---- spinTaeglich ---- spinTaeglich.setFont(new Font("Arial", Font.PLAIN, 14)); spinTaeglich.setModel(new SpinnerNumberModel(1, null, null, 1)); pnlDaily.add(spinTaeglich, CC.xy(5, 3)); //---- lblDays ---- lblDays.setText("Tage"); lblDays.setFont(new Font("Arial", Font.PLAIN, 14)); pnlDaily.add(lblDays, CC.xy(7, 3)); //---- btnJedenTag ---- btnJedenTag.setText("Jeden Tag"); btnJedenTag.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnJedenTagActionPerformed(e); } }); pnlDaily.add(btnJedenTag, CC.xywh(2, 5, 6, 1)); } tabWdh.addTab("T\u00e4glich", pnlDaily); //======== pnlWeekly ======== { pnlWeekly.setFont(new Font("Arial", Font.PLAIN, 14)); pnlWeekly.setLayout(new FormLayout("default, 7*(13dlu), $lcgap, default:grow", "$ugap, $lgap, default, $lgap, fill:53dlu:grow, $nlgap, default:grow, $lgap, $rgap")); //======== panel3 ======== { panel3.setLayout( new FormLayout("default, $rgap, 40dlu, $rgap, 2*(default), $lcgap, default, $lcgap", "default:grow, $lgap, default")); //---- btnJedeWoche ---- btnJedeWoche.setText("Jede Woche"); btnJedeWoche.setFont(new Font("Arial", Font.PLAIN, 14)); btnJedeWoche.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnJedeWocheActionPerformed(e); } }); panel3.add(btnJedeWoche, CC.xywh(3, 3, 3, 1)); //---- lblEveryWeek ---- lblEveryWeek.setText("alle"); lblEveryWeek.setFont(new Font("Arial", Font.PLAIN, 14)); panel3.add(lblEveryWeek, CC.xy(1, 1)); panel3.add(spinWoche, CC.xy(3, 1)); //---- lblWeeks ---- lblWeeks.setText("Wochen am"); lblWeeks.setFont(new Font("Arial", Font.PLAIN, 14)); panel3.add(lblWeeks, CC.xy(5, 1)); } pnlWeekly.add(panel3, CC.xywh(2, 3, 9, 1)); //---- lblUhrzeit2 ---- lblUhrzeit2.setText("montags"); lblUhrzeit2.setOrientation(1); lblUhrzeit2.setFont(new Font("Arial", Font.PLAIN, 14)); lblUhrzeit2.setClockwise(false); lblUhrzeit2.setHorizontalTextPosition(SwingConstants.LEFT); pnlWeekly.add(lblUhrzeit2, CC.xy(2, 5, CC.CENTER, CC.BOTTOM)); //---- lblUhrzeit3 ---- lblUhrzeit3.setText("dienstags"); lblUhrzeit3.setOrientation(1); lblUhrzeit3.setFont(new Font("Arial", Font.PLAIN, 14)); lblUhrzeit3.setClockwise(false); lblUhrzeit3.setHorizontalTextPosition(SwingConstants.LEFT); pnlWeekly.add(lblUhrzeit3, CC.xy(3, 5, CC.CENTER, CC.BOTTOM)); //---- lblUhrzeit4 ---- lblUhrzeit4.setText("mittwochs"); lblUhrzeit4.setOrientation(1); lblUhrzeit4.setFont(new Font("Arial", Font.PLAIN, 14)); lblUhrzeit4.setClockwise(false); lblUhrzeit4.setHorizontalTextPosition(SwingConstants.LEFT); pnlWeekly.add(lblUhrzeit4, CC.xy(4, 5, CC.CENTER, CC.BOTTOM)); //---- lblUhrzeit5 ---- lblUhrzeit5.setText("donnerstags"); lblUhrzeit5.setOrientation(1); lblUhrzeit5.setFont(new Font("Arial", Font.PLAIN, 14)); lblUhrzeit5.setClockwise(false); lblUhrzeit5.setHorizontalTextPosition(SwingConstants.LEFT); pnlWeekly.add(lblUhrzeit5, CC.xy(5, 5, CC.CENTER, CC.BOTTOM)); //---- lblUhrzeit6 ---- lblUhrzeit6.setText("freitags"); lblUhrzeit6.setOrientation(1); lblUhrzeit6.setFont(new Font("Arial", Font.PLAIN, 14)); lblUhrzeit6.setClockwise(false); lblUhrzeit6.setHorizontalTextPosition(SwingConstants.LEFT); pnlWeekly.add(lblUhrzeit6, CC.xy(6, 5, CC.CENTER, CC.BOTTOM)); //---- lblUhrzeit7 ---- lblUhrzeit7.setText("samstags"); lblUhrzeit7.setOrientation(1); lblUhrzeit7.setFont(new Font("Arial", Font.PLAIN, 14)); lblUhrzeit7.setClockwise(false); lblUhrzeit7.setHorizontalTextPosition(SwingConstants.LEFT); pnlWeekly.add(lblUhrzeit7, CC.xy(7, 5, CC.CENTER, CC.BOTTOM)); //---- lblUhrzeit8 ---- lblUhrzeit8.setText("sonntags"); lblUhrzeit8.setOrientation(1); lblUhrzeit8.setFont(new Font("Arial", Font.PLAIN, 14)); lblUhrzeit8.setClockwise(false); lblUhrzeit8.setHorizontalTextPosition(SwingConstants.LEFT); pnlWeekly.add(lblUhrzeit8, CC.xy(8, 5, CC.CENTER, CC.BOTTOM)); //---- cbMon ---- cbMon.setBorder(BorderFactory.createEmptyBorder()); cbMon.setMargin(new Insets(0, 0, 0, 0)); cbMon.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cbMonActionPerformed(e); } }); pnlWeekly.add(cbMon, CC.xy(2, 7, CC.CENTER, CC.DEFAULT)); //---- cbDie ---- cbDie.setBorder(BorderFactory.createEmptyBorder()); cbDie.setMargin(new Insets(0, 0, 0, 0)); cbDie.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cbDieActionPerformed(e); } }); pnlWeekly.add(cbDie, CC.xy(3, 7, CC.CENTER, CC.DEFAULT)); //---- cbMit ---- cbMit.setBorder(BorderFactory.createEmptyBorder()); cbMit.setMargin(new Insets(0, 0, 0, 0)); cbMit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cbMitActionPerformed(e); } }); pnlWeekly.add(cbMit, CC.xy(4, 7, CC.CENTER, CC.DEFAULT)); //---- cbDon ---- cbDon.setBorder(BorderFactory.createEmptyBorder()); cbDon.setMargin(new Insets(0, 0, 0, 0)); cbDon.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cbDonActionPerformed(e); } }); pnlWeekly.add(cbDon, CC.xy(5, 7, CC.CENTER, CC.DEFAULT)); //---- cbFre ---- cbFre.setBorder(BorderFactory.createEmptyBorder()); cbFre.setMargin(new Insets(0, 0, 0, 0)); cbFre.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cbFreActionPerformed(e); } }); pnlWeekly.add(cbFre, CC.xy(6, 7, CC.CENTER, CC.DEFAULT)); //---- cbSam ---- cbSam.setBorder(BorderFactory.createEmptyBorder()); cbSam.setMargin(new Insets(0, 0, 0, 0)); cbSam.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cbSamActionPerformed(e); } }); pnlWeekly.add(cbSam, CC.xy(7, 7, CC.CENTER, CC.DEFAULT)); //---- cbSon ---- cbSon.setBorder(BorderFactory.createEmptyBorder()); cbSon.setMargin(new Insets(0, 0, 0, 0)); cbSon.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cbSonActionPerformed(e); } }); pnlWeekly.add(cbSon, CC.xy(8, 7, CC.CENTER, CC.DEFAULT)); } tabWdh.addTab("W\u00f6chentlich", pnlWeekly); //======== pnlMonthly ======== { pnlMonthly.setFont(new Font("Arial", Font.PLAIN, 14)); pnlMonthly.setLayout( new FormLayout("default, $lcgap, pref, $lcgap, 40dlu, $lcgap, pref, $lcgap, 61dlu", "3*(default, $lgap), default")); //---- lblEveryMonth ---- lblEveryMonth.setText("jeden"); lblEveryMonth.setFont(new Font("Arial", Font.PLAIN, 14)); lblEveryMonth.setHorizontalAlignment(SwingConstants.TRAILING); pnlMonthly.add(lblEveryMonth, CC.xy(3, 3)); //---- spinMonat ---- spinMonat.setFont(new Font("Arial", Font.PLAIN, 14)); pnlMonthly.add(spinMonat, CC.xy(5, 3)); //---- lblMonth ---- lblMonth.setText("Monat"); lblMonth.setFont(new Font("Arial", Font.PLAIN, 14)); pnlMonthly.add(lblMonth, CC.xy(7, 3)); //---- btnJedenMonat ---- btnJedenMonat.setText("Jeden Monat"); btnJedenMonat.setFont(new Font("Arial", Font.PLAIN, 14)); btnJedenMonat.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnJedenMonatActionPerformed(e); } }); pnlMonthly.add(btnJedenMonat, CC.xywh(3, 5, 5, 1)); //---- llblOnDayOfMonth ---- llblOnDayOfMonth.setText("jeweils am"); llblOnDayOfMonth.setFont(new Font("Arial", Font.PLAIN, 14)); llblOnDayOfMonth.setHorizontalAlignment(SwingConstants.TRAILING); pnlMonthly.add(llblOnDayOfMonth, CC.xy(3, 7)); //---- spinDayInMonth ---- spinDayInMonth.setFont(new Font("Arial", Font.PLAIN, 14)); spinDayInMonth.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { spinMonatTagStateChanged(e); } }); pnlMonthly.add(spinDayInMonth, CC.xy(5, 7)); //---- cmbTag ---- cmbTag.setModel(new DefaultComboBoxModel<>(new String[] { "Tag des Monats", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag" })); cmbTag.setFont(new Font("Arial", Font.PLAIN, 14)); cmbTag.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cmbTagItemStateChanged(e); } }); pnlMonthly.add(cmbTag, CC.xywh(7, 7, 3, 1)); } tabWdh.addTab("Monatlich", pnlMonthly); //======== pnlYearly ======== { pnlYearly.setLayout(new FormLayout("30dlu, $rgap, 26dlu, $rgap, pref, $ugap, default", "default, 15dlu, default")); //---- lblEveryYear ---- lblEveryYear.setText("alle"); lblEveryYear.setFont(new Font("Arial", Font.PLAIN, 14)); lblEveryYear.setHorizontalAlignment(SwingConstants.TRAILING); pnlYearly.add(lblEveryYear, CC.xy(1, 1)); //---- spinYearly ---- spinYearly.setFont(new Font("Arial", Font.PLAIN, 14)); pnlYearly.add(spinYearly, CC.xy(3, 1)); //---- lblYear ---- lblYear.setText("Jahre"); lblYear.setFont(new Font("Arial", Font.PLAIN, 14)); pnlYearly.add(lblYear, CC.xy(5, 1)); //---- btnEveryYear ---- btnEveryYear.setText("jedes Jahr"); btnEveryYear.setFont(new Font("Arial", Font.PLAIN, 14)); btnEveryYear.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnEveryYearActionPerformed(e); } }); pnlYearly.add(btnEveryYear, CC.xy(7, 1)); //---- lblOnDay ---- lblOnDay.setText("alle"); lblOnDay.setFont(new Font("Arial", Font.PLAIN, 14)); lblOnDay.setHorizontalAlignment(SwingConstants.TRAILING); pnlYearly.add(lblOnDay, CC.xy(1, 3)); //---- spinDayInMonthInYear ---- spinDayInMonthInYear.setFont(new Font("Arial", Font.PLAIN, 14)); pnlYearly.add(spinDayInMonthInYear, CC.xy(3, 3)); pnlYearly.add(cmbMonth, CC.xywh(5, 3, 3, 1)); } tabWdh.addTab("text", pnlYearly); } panelMain.add(tabWdh, CC.xywh(3, 11, 3, 1, CC.FILL, CC.FILL)); //---- lblLDate ---- lblLDate.setText("text"); lblLDate.setFont(new Font("Arial", Font.PLAIN, 10)); lblLDate.setHorizontalAlignment(SwingConstants.TRAILING); panelMain.add(lblLDate, CC.xy(5, 13)); panelMain.add(jdcStartingOn, CC.xywh(3, 15, 3, 1)); //======== jScrollPane1 ======== { //---- txtBemerkung ---- txtBemerkung.setColumns(20); txtBemerkung.setRows(5); txtBemerkung.setFont(new Font("Arial", Font.PLAIN, 14)); txtBemerkung.setLineWrap(true); txtBemerkung.setWrapStyleWord(true); jScrollPane1.setViewportView(txtBemerkung); } panelMain.add(jScrollPane1, CC.xywh(3, 17, 3, 1, CC.DEFAULT, CC.FILL)); //---- btnSave ---- btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png"))); btnSave.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnSaveActionPerformed(e); } }); panelMain.add(btnSave, CC.xy(5, 19, CC.RIGHT, CC.DEFAULT)); //---- lblDueDays ---- lblDueDays.setText("text"); lblDueDays.setFont(new Font("Arial", Font.PLAIN, 10)); lblDueDays.setHorizontalAlignment(SwingConstants.TRAILING); panelMain.add(lblDueDays, CC.xy(3, 5)); //---- txtDueDays ---- txtDueDays.setFont(new Font("Arial", Font.PLAIN, 14)); panelMain.add(txtDueDays, CC.xy(3, 7, CC.DEFAULT, CC.FILL)); } add(panelMain, BorderLayout.CENTER); //---- buttonGroup1 ---- ButtonGroup buttonGroup1 = new ButtonGroup(); buttonGroup1.add(cbMon); buttonGroup1.add(cbDie); buttonGroup1.add(cbMit); buttonGroup1.add(cbDon); buttonGroup1.add(cbFre); buttonGroup1.add(cbSam); buttonGroup1.add(cbSon); }
From source file:org.accretegb.modules.germplasm.stockannotation.StockAnnotationPanel.java
private JPanel addStockPanelToolButtons() { JPanel panel = new JPanel(); panel.setLayout(new MigLayout("insets 0 0 0 0, gapx 0")); List<Integer> editableColumns = new ArrayList<Integer>(); editableColumns.add(stockTablePanel.getTable().getIndexOf(ColumnConstants.ACCESSION)); editableColumns.add(stockTablePanel.getTable().getIndexOf(ColumnConstants.PEDIGREE)); editableColumns.add(stockTablePanel.getTable().getIndexOf(ColumnConstants.GENERATION)); stockTablePanel.getTable().setEditableColumns(editableColumns); ;/*w w w . ja v a 2 s .com*/ JButton importStockList = new JButton("Import Stocks By Search"); JButton importHarvestGroup = new JButton("Import Stocks From Harvest Group"); JPanel subPanel1 = new JPanel(); subPanel1.setLayout(new MigLayout("insets 0 0 0 0, gapx 0")); subPanel1.add(importStockList, "gapRight 10"); subPanel1.add(importHarvestGroup, "gapRight 10, wrap"); panel.add(subPanel1, "gapLeft 10, spanx,wrap"); importStockList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { StocksInfoPanel stockInfoPanel = CreateStocksInfoPanel .createStockInfoPanel("stock annotation popup"); stockInfoPanel.setSize(new Dimension(500, 400)); int option = JOptionPane.showConfirmDialog(null, stockInfoPanel, "Search Stock Packets", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); ArrayList<Integer> stockIds = new ArrayList<Integer>(); if (option == JOptionPane.OK_OPTION) { DefaultTableModel model = (DefaultTableModel) stockTablePanel.getTable().getModel(); CheckBoxIndexColumnTable stocksOutputTable = stockInfoPanel.getSaveTablePanel().getTable(); for (int row = 0; row < stocksOutputTable.getRowCount(); ++row) { int stockId = (Integer) stocksOutputTable.getValueAt(row, stocksOutputTable.getIndexOf(ColumnConstants.STOCK_ID)); stockIds.add(stockId); } List<Stock> stocks = StockDAO.getInstance().getStocksByIds(stockIds); for (Stock stock : stocks) { Object[] rowData = new Object[stockTablePanel.getTable().getColumnCount()]; rowData[0] = new Boolean(false); Passport passport = stock.getPassport(); StockGeneration generation = stock.getStockGeneration(); rowData[stockTablePanel.getTable().getIndexOf(ColumnConstants.STOCK_NAME)] = stock .getStockName(); rowData[stockTablePanel.getTable().getIndexOf(ColumnConstants.STOCK_ID)] = stock .getStockId(); rowData[stockTablePanel.getTable() .getIndexOf(ColumnConstants.GENERATION)] = generation == null ? null : generation.getGeneration(); rowData[stockTablePanel.getTable().getIndexOf( ColumnConstants.PASSPORT_ID)] = passport == null ? null : passport.getPassportId(); rowData[stockTablePanel.getTable().getIndexOf(ColumnConstants.ACCESSION)] = passport == null ? null : passport.getAccession_name(); rowData[stockTablePanel.getTable().getIndexOf(ColumnConstants.PEDIGREE)] = passport == null ? null : passport.getPedigree(); rowData[stockTablePanel.getTable().getIndexOf( ColumnConstants.CLASSIFICATION_CODE)] = passport.getClassification() == null ? null : passport.getClassification().getClassificationCode(); rowData[stockTablePanel.getTable().getIndexOf( ColumnConstants.CLASSIFICATION_ID)] = passport.getClassification() == null ? null : passport.getClassification().getClassificationId(); rowData[stockTablePanel.getTable() .getIndexOf(ColumnConstants.POPULATION)] = passport.getTaxonomy() == null ? null : passport.getTaxonomy().getPopulation(); rowData[stockTablePanel.getTable() .getIndexOf(ColumnConstants.TAXONOMY_ID)] = passport.getTaxonomy() == null ? null : passport.getTaxonomy().getTaxonomyId(); rowData[stockTablePanel.getTable().getIndexOf(ColumnConstants.MODIFIED)] = new Boolean( false); model.addRow(rowData); } } } }); importHarvestGroup.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ArrayList<PMProject> projects = TokenRelationDAO.getInstance() .findProjectObjects(LoginScreen.loginUserId); HashMap<String, Harvesting> name_tap = new HashMap<String, Harvesting>(); for (PMProject project : projects) { List<HarvestingGroup> HarvestingGroups = HarvestingGroupDAO.getInstance() .findByProjectid(project.getProjectId()); for (HarvestingGroup hg : HarvestingGroups) { Harvesting harvestingPanel = (Harvesting) getContext() .getBean("Harvesting - " + project.getProjectId() + hg.getHarvestingGroupName()); name_tap.put(project.getProjectName() + "-" + hg.getHarvestingGroupName(), harvestingPanel); } } JPanel popup = new JPanel(new MigLayout("insets 0, gap 5")); JScrollPane jsp = new JScrollPane(popup) { @Override public Dimension getPreferredSize() { return new Dimension(250, 320); } }; ButtonGroup group = new ButtonGroup(); for (String name : name_tap.keySet()) { JRadioButton button = new JRadioButton(name); group.add(button); popup.add(button, "wrap"); button.setSelected(true); } String selected_group = null; int option = JOptionPane.showConfirmDialog(null, jsp, "Select Harvesting Group Name: ", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { for (Enumeration<AbstractButton> buttons = group.getElements(); buttons.hasMoreElements();) { AbstractButton button = buttons.nextElement(); if (button.isSelected()) { selected_group = button.getText(); } } } if (selected_group != null) { Harvesting harvestingPanel = name_tap.get(selected_group); DefaultTableModel model = (DefaultTableModel) stockTablePanel.getTable().getModel(); ArrayList<String> stocknames = harvestingPanel.getStickerGenerator().getCreatedStocks(); List<Stock> stocks = StockDAO.getInstance().getStocksByNames(stocknames); for (Stock stock : stocks) { Object[] rowData = new Object[stockTablePanel.getTable().getColumnCount()]; rowData[0] = new Boolean(false); Passport passport = stock.getPassport(); StockGeneration generation = stock.getStockGeneration(); rowData[stockTablePanel.getTable().getIndexOf(ColumnConstants.STOCK_NAME)] = stock .getStockName(); rowData[stockTablePanel.getTable().getIndexOf(ColumnConstants.STOCK_ID)] = stock .getStockId(); rowData[stockTablePanel.getTable() .getIndexOf(ColumnConstants.GENERATION)] = generation == null ? null : generation.getGeneration(); rowData[stockTablePanel.getTable().getIndexOf( ColumnConstants.PASSPORT_ID)] = passport == null ? null : passport.getPassportId(); rowData[stockTablePanel.getTable().getIndexOf(ColumnConstants.ACCESSION)] = passport == null ? null : passport.getAccession_name(); rowData[stockTablePanel.getTable().getIndexOf(ColumnConstants.PEDIGREE)] = passport == null ? null : passport.getPedigree(); rowData[stockTablePanel.getTable().getIndexOf( ColumnConstants.CLASSIFICATION_CODE)] = passport.getClassification() == null ? null : passport.getClassification().getClassificationCode(); rowData[stockTablePanel.getTable().getIndexOf( ColumnConstants.CLASSIFICATION_ID)] = passport.getClassification() == null ? null : passport.getClassification().getClassificationId(); rowData[stockTablePanel.getTable() .getIndexOf(ColumnConstants.POPULATION)] = passport.getTaxonomy() == null ? null : passport.getTaxonomy().getPopulation(); rowData[stockTablePanel.getTable() .getIndexOf(ColumnConstants.TAXONOMY_ID)] = passport.getTaxonomy() == null ? null : passport.getTaxonomy().getTaxonomyId(); rowData[stockTablePanel.getTable().getIndexOf(ColumnConstants.MODIFIED)] = new Boolean( false); model.addRow(rowData); } } } }); getstockTablePanel().getTable().addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent e) { int row = getstockTablePanel().getTable().getSelectionModel().getAnchorSelectionIndex(); getstockTablePanel().getTable().setValueAt(true, row, getstockTablePanel().getTable().getIndexOf(ColumnConstants.MODIFIED)); } }); JPanel subPanel2 = new JPanel(); subPanel2.setLayout(new MigLayout("insets 0 0 0 0 , gapx 0")); subPanel2.add(new JLabel("Pedigree: ")); this.pedigreeField = new JTextField(10); subPanel2.add(pedigreeField); JButton setPedigree = new JButton("set"); setPedigree.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { for (int row : getstockTablePanel().getTable().getSelectedRows()) { getstockTablePanel().getTable().setValueAt(pedigreeField.getText(), row, getstockTablePanel().getTable().getIndexOf(ColumnConstants.PEDIGREE)); getstockTablePanel().getTable().setValueAt(true, row, getstockTablePanel().getTable().getIndexOf(ColumnConstants.MODIFIED)); } } }); subPanel2.add(setPedigree, "gapRight 15"); subPanel2.add(new JLabel("Accession: ")); this.accessionField = new JTextField(10); subPanel2.add(accessionField); JButton setAccession = new JButton("set"); setAccession.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { for (int row : getstockTablePanel().getTable().getSelectedRows()) { getstockTablePanel().getTable().setValueAt(accessionField.getText(), row, getstockTablePanel().getTable().getIndexOf(ColumnConstants.ACCESSION)); getstockTablePanel().getTable().setValueAt(true, row, getstockTablePanel().getTable().getIndexOf(ColumnConstants.MODIFIED)); } } }); subPanel2.add(setAccession, "gapRight 15"); subPanel2.add(new JLabel("Generarion: ")); this.generarionField = new JTextField(10); subPanel2.add(generarionField); JButton setGeneration = new JButton("set"); setGeneration.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { for (int row : getstockTablePanel().getTable().getSelectedRows()) { getstockTablePanel().getTable().setValueAt(generarionField.getText(), row, getstockTablePanel().getTable().getIndexOf(ColumnConstants.GENERATION)); getstockTablePanel().getTable().setValueAt(true, row, getstockTablePanel().getTable().getIndexOf(ColumnConstants.MODIFIED)); } } }); subPanel2.add(setGeneration); panel.add(subPanel2, "gapLeft 10,spanx"); return panel; }
From source file:org.apache.uima.tools.docanalyzer.DBAnnotationViewerDialog.java
/** * Create an AnnotationViewer Dialog//from w w w . j a va 2 s .c o m * * @param aParentFrame * frame containing this panel * @param aTitle * title to display for the dialog * @param aInputDir * directory containing input files (in XCAS foramt) to read * @param aStyleMapFile * filename of style map to be used to view files in HTML * @param aPerformanceStats * string representaiton of performance statistics, optional. * @param aTypeSystem * the CAS Type System to which the XCAS files must conform. * @param aTypesToDisplay * array of types that should be highlighted in the viewer. This can be set to the output * types of the Analysis Engine. A value of null means to display all types. */ /*public DBAnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, DBPrefsMediator med, File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem, final String[] aTypesToDisplay, String interactiveTempFN, boolean javaViewerRBisSelected, boolean javaViewerUCRBisSelected, boolean xmlRBisSelected, CAS cas) { super(aParentFrame, aDialogTitle); // create the AnnotationViewGenerator (for HTML view generation) this.med1 = med; this.cas = cas; annotationViewGenerator = new AnnotationViewGenerator(tempDir); launchThatViewer(med.getOutputDir(), interactiveTempFN, aTypeSystem, aTypesToDisplay, javaViewerRBisSelected, javaViewerUCRBisSelected, xmlRBisSelected, aStyleMapFile, tempDir); }*/ public DBAnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, DBPrefsMediator med, File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem, final String[] aTypesToDisplay, boolean generatedStyleMap, CAS cas) { super(aParentFrame, aDialogTitle); this.xmiDAO = med.getXmiDAO(); this.med1 = med; this.cas = cas; styleMapFile = aStyleMapFile; final String performanceStats = aPerformanceStats; typeSystem = aTypeSystem; typesToDisplay = aTypesToDisplay; // create the AnnotationViewGenerator (for HTML view generation) annotationViewGenerator = new AnnotationViewGenerator(tempDir); // create StyleMapEditor dialog styleMapEditor = new StyleMapEditor(aParentFrame, cas); JPanel resultsTitlePanel = new JPanel(); resultsTitlePanel.setLayout(new BoxLayout(resultsTitlePanel, BoxLayout.Y_AXIS)); resultsTitlePanel.add(new JLabel("These are the Analyzed Documents.")); resultsTitlePanel.add(new JLabel("Select viewer type and double-click file to open.")); try { String[] documents = this.xmiDAO.getXMIList(); analyzedResultsList = new JList(documents); } catch (DAOException e) { displayError(e.getMessage()); } /* * File[] documents = dir.listFiles(); Vector docVector = new Vector(); for (int i = 0; i < * documents.length; i++) { if (documents[i].isFile()) { docVector.add(documents[i].getName()); } } * final JList analyzedResultsList = new JList(docVector); */ JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().add(analyzedResultsList, null); JPanel southernPanel = new JPanel(); southernPanel.setLayout(new BoxLayout(southernPanel, BoxLayout.Y_AXIS)); JPanel controlsPanel = new JPanel(); controlsPanel.setLayout(new SpringLayout()); Caption displayFormatLabel = new Caption("Results Display Format:"); controlsPanel.add(displayFormatLabel); JPanel displayFormatPanel = new JPanel(); displayFormatPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); displayFormatPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); javaViewerRB = new JRadioButton("Java Viewer"); javaViewerUCRB = new JRadioButton("JV user colors"); htmlRB = new JRadioButton("HTML"); xmlRB = new JRadioButton("XML"); ButtonGroup displayFormatButtonGroup = new ButtonGroup(); displayFormatButtonGroup.add(javaViewerRB); displayFormatButtonGroup.add(javaViewerUCRB); displayFormatButtonGroup.add(htmlRB); displayFormatButtonGroup.add(xmlRB); // select the appropraite viewer button according to user's prefs javaViewerRB.setSelected(true); // default, overriden below if ("Java Viewer".equals(med.getViewType())) { javaViewerRB.setSelected(true); } else if ("JV User Colors".equals(med.getViewType())) { javaViewerUCRB.setSelected(true); } else if ("HTML".equals(med.getViewType())) { htmlRB.setSelected(true); } else if ("XML".equals(med.getViewType())) { xmlRB.setSelected(true); } displayFormatPanel.add(javaViewerRB); displayFormatPanel.add(javaViewerUCRB); displayFormatPanel.add(htmlRB); displayFormatPanel.add(xmlRB); controlsPanel.add(displayFormatPanel); SpringUtilities.makeCompactGrid(controlsPanel, 1, 2, // rows, cols 4, 4, // initX, initY 0, 0); // xPad, yPad JButton editStyleMapButton = new JButton("Edit Style Map"); // event for the editStyleMapButton button editStyleMapButton.addActionListener(this); southernPanel.add(controlsPanel); // southernPanel.add( new JSeparator() ); JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); // APL: edit style map feature disabled for SDK buttonsPanel.add(editStyleMapButton); if (performanceStats != null) { JButton perfStatsButton = new JButton("Performance Stats"); perfStatsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { JOptionPane.showMessageDialog((Component) ae.getSource(), performanceStats, null, JOptionPane.PLAIN_MESSAGE); } }); buttonsPanel.add(perfStatsButton); } JButton closeButton = new JButton("Close"); buttonsPanel.add(closeButton); southernPanel.add(buttonsPanel); // add jlist and panel container to Dialog getContentPane().add(resultsTitlePanel, BorderLayout.NORTH); getContentPane().add(scrollPane, BorderLayout.CENTER); getContentPane().add(southernPanel, BorderLayout.SOUTH); // event for the closeButton button closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { DBAnnotationViewerDialog.this.setVisible(false); } }); // event for analyzedResultsDialog window closing this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLF(); // set default look and feel analyzedResultsList.setCellRenderer(new MyListCellRenderer()); // doubleclicking on document shows the annotated result MouseListener mouseListener = new ListMouseAdapter(); // styleMapFile, analyzedResultsList, // inputDirPath,typeSystem , typesToDisplay , // javaViewerRB , javaViewerUCRB ,xmlRB , // viewerDirectory , this); // add mouse Listener to the list analyzedResultsList.addMouseListener(mouseListener); }
From source file:org.barcelonamedia.uima.tools.docanalyzer.DBAnnotationViewerDialog.java
/** * Create an AnnotationViewer Dialog/* w w w . ja va 2s . c o m*/ * * @param aParentFrame * frame containing this panel * @param aTitle * title to display for the dialog * @param aInputDir * directory containing input files (in XCAS foramt) to read * @param aStyleMapFile * filename of style map to be used to view files in HTML * @param aPerformanceStats * string representaiton of performance statistics, optional. * @param aTypeSystem * the CAS Type System to which the XCAS files must conform. * @param aTypesToDisplay * array of types that should be highlighted in the viewer. This can be set to the output * types of the Analysis Engine. A value of null means to display all types. */ /*public DBAnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, DBPrefsMediator med, File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem, final String[] aTypesToDisplay, String interactiveTempFN, boolean javaViewerRBisSelected, boolean javaViewerUCRBisSelected, boolean xmlRBisSelected, CAS cas) { super(aParentFrame, aDialogTitle); // create the AnnotationViewGenerator (for HTML view generation) this.med1 = med; this.cas = cas; annotationViewGenerator = new AnnotationViewGenerator(tempDir); launchThatViewer(med.getOutputDir(), interactiveTempFN, aTypeSystem, aTypesToDisplay, javaViewerRBisSelected, javaViewerUCRBisSelected, xmlRBisSelected, aStyleMapFile, tempDir); }*/ public DBAnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, DBPrefsMediator med, File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem, final String[] aTypesToDisplay, boolean generatedStyleMap, CAS cas) { super(aParentFrame, aDialogTitle); this.xmiDAO = med.getXmiDAO(); this.med1 = med; this.cas = cas; styleMapFile = aStyleMapFile; final String performanceStats = aPerformanceStats; typeSystem = aTypeSystem; typesToDisplay = aTypesToDisplay; // create the AnnotationViewGenerator (for HTML view generation) annotationViewGenerator = new AnnotationViewGenerator(tempDir); // create StyleMapEditor dialog styleMapEditor = new StyleMapEditor(aParentFrame, cas); JPanel resultsTitlePanel = new JPanel(); resultsTitlePanel.setLayout(new BoxLayout(resultsTitlePanel, BoxLayout.Y_AXIS)); resultsTitlePanel.add(new JLabel("These are the Analyzed Documents.")); resultsTitlePanel.add(new JLabel("Select viewer type and double-click file to open.")); try { String[] documents = this.xmiDAO.getXMIList(); analyzedResultsList = new JList(documents); JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().add(analyzedResultsList, null); JPanel southernPanel = new JPanel(); southernPanel.setLayout(new BoxLayout(southernPanel, BoxLayout.Y_AXIS)); JPanel controlsPanel = new JPanel(); controlsPanel.setLayout(new SpringLayout()); Caption displayFormatLabel = new Caption("Results Display Format:"); controlsPanel.add(displayFormatLabel); JPanel displayFormatPanel = new JPanel(); displayFormatPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); displayFormatPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); javaViewerRB = new JRadioButton("Java Viewer"); javaViewerUCRB = new JRadioButton("JV user colors"); htmlRB = new JRadioButton("HTML"); xmlRB = new JRadioButton("XML"); ButtonGroup displayFormatButtonGroup = new ButtonGroup(); displayFormatButtonGroup.add(javaViewerRB); displayFormatButtonGroup.add(javaViewerUCRB); displayFormatButtonGroup.add(htmlRB); displayFormatButtonGroup.add(xmlRB); // select the appropraite viewer button according to user's prefs javaViewerRB.setSelected(true); // default, overriden below if ("Java Viewer".equals(med.getViewType())) { javaViewerRB.setSelected(true); } else if ("JV User Colors".equals(med.getViewType())) { javaViewerUCRB.setSelected(true); } else if ("HTML".equals(med.getViewType())) { htmlRB.setSelected(true); } else if ("XML".equals(med.getViewType())) { xmlRB.setSelected(true); } displayFormatPanel.add(javaViewerRB); displayFormatPanel.add(javaViewerUCRB); displayFormatPanel.add(htmlRB); displayFormatPanel.add(xmlRB); controlsPanel.add(displayFormatPanel); SpringUtilities.makeCompactGrid(controlsPanel, 1, 2, // rows, cols 4, 4, // initX, initY 0, 0); // xPad, yPad JButton editStyleMapButton = new JButton("Edit Style Map"); // event for the editStyleMapButton button editStyleMapButton.addActionListener(this); southernPanel.add(controlsPanel); // southernPanel.add( new JSeparator() ); JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); // APL: edit style map feature disabled for SDK buttonsPanel.add(editStyleMapButton); if (performanceStats != null) { JButton perfStatsButton = new JButton("Performance Stats"); perfStatsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { JOptionPane.showMessageDialog((Component) ae.getSource(), performanceStats, null, JOptionPane.PLAIN_MESSAGE); } }); buttonsPanel.add(perfStatsButton); } JButton closeButton = new JButton("Close"); buttonsPanel.add(closeButton); southernPanel.add(buttonsPanel); // add list and panel container to Dialog getContentPane().add(resultsTitlePanel, BorderLayout.NORTH); getContentPane().add(scrollPane, BorderLayout.CENTER); getContentPane().add(southernPanel, BorderLayout.SOUTH); // event for the closeButton button closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { DBAnnotationViewerDialog.this.setVisible(false); } }); // event for analyzedResultsDialog window closing this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLF(); // set default look and feel analyzedResultsList.setCellRenderer(new MyListCellRenderer()); // doubleclicking on document shows the annotated result MouseListener mouseListener = new ListMouseAdapter(); // styleMapFile, analyzedResultsList, // inputDirPath,typeSystem , typesToDisplay , // javaViewerRB , javaViewerUCRB ,xmlRB , // viewerDirectory , this); // add mouse Listener to the list analyzedResultsList.addMouseListener(mouseListener); } catch (DAOException e) { displayError(e.getMessage()); this.dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING)); } }
From source file:org.bigwiv.blastgraph.gui.BlastGraphFrame.java
/** * initialize LayoutMenu//from ww w . j a va 2s. c o m * * @return */ private JMenu getLayoutMenu() { if (layoutMenu == null) { layoutMenu = new JMenu(); final JRadioButtonMenuItem frButton = new JRadioButtonMenuItem(LayoutType.FRLayout.toString()); final JRadioButtonMenuItem ewButton = new JRadioButtonMenuItem(LayoutType.EWLayout.toString()); ItemListener layoutMenuItemListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { if (e.getItem().equals(frButton)) { setLayout(LayoutType.FRLayout); layoutBox.setSelectedItem(LayoutType.FRLayout); } else if (e.getItem().equals(ewButton)) { setLayout(LayoutType.EWLayout); layoutBox.setSelectedItem(LayoutType.EWLayout); } } } }; frButton.addItemListener(layoutMenuItemListener); ewButton.addItemListener(layoutMenuItemListener); ButtonGroup radio = new ButtonGroup(); radio.add(frButton); radio.add(ewButton); frButton.setSelected(true); layoutMenu.add(frButton); layoutMenu.add(ewButton); layoutMenu.setToolTipText("Menu for setting graph layout"); // layoutMenu.addItemListener(layoutMenuItemListener); layoutBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { if (e.getItem().equals(LayoutType.FRLayout)) { frButton.setSelected(true); } else if (e.getItem().equals(LayoutType.EWLayout)) { ewButton.setSelected(true); } } } }); } return layoutMenu; }
From source file:org.broad.igv.track.TrackMenuUtils.java
public static void addDisplayModeItems(final Collection<Track> tracks, JPopupMenu menu) { // Find "most representative" state from track collection Map<Track.DisplayMode, Integer> counts = new HashMap<Track.DisplayMode, Integer>( Track.DisplayMode.values().length); Track.DisplayMode currentMode = null; for (Track t : tracks) { Track.DisplayMode mode = t.getDisplayMode(); if (counts.containsKey(mode)) { counts.put(mode, counts.get(mode) + 1); } else {//ww w . j a v a2s. c o m counts.put(mode, 1); } } int maxCount = -1; for (Map.Entry<Track.DisplayMode, Integer> count : counts.entrySet()) { if (count.getValue() > maxCount) { currentMode = count.getKey(); maxCount = count.getValue(); } } ButtonGroup group = new ButtonGroup(); Map<String, Track.DisplayMode> modes = new LinkedHashMap<String, Track.DisplayMode>(4); modes.put("Collapsed", Track.DisplayMode.COLLAPSED); modes.put("Expanded", Track.DisplayMode.EXPANDED); modes.put("Squished", Track.DisplayMode.SQUISHED); boolean showAS = Boolean.parseBoolean(System.getProperty("showAS", "false")); if (showAS) { modes.put("Alternative Splice", Track.DisplayMode.ALTERNATIVE_SPLICE); } for (final Map.Entry<String, Track.DisplayMode> entry : modes.entrySet()) { JRadioButtonMenuItem mm = new JRadioButtonMenuItem(entry.getKey()); mm.setSelected(currentMode == entry.getValue()); mm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { setTrackDisplayMode(tracks, entry.getValue()); refresh(); } }); group.add(mm); menu.add(mm); } }