List of usage examples for javax.swing JTable JTable
public JTable()
JTable
that is initialized with a default data model, a default column model, and a default selection model. From source file:com.tiempometa.muestradatos.JReadTags.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents ResourceBundle bundle = ResourceBundle.getBundle("com.tiempometa.muestradatos.muestradatos"); dialogPane = new JPanel(); contentPanel = new JPanel(); label2 = new JLabel(); nextBibTextField = new JTextField(); statusLabel = new JLabel(); startReadingButton = new JButton(); bibLabel = new JLabel(); scrollPane1 = new JScrollPane(); tagReadTable = new JTable(); label3 = new JLabel(); tidTextField = new JTextField(); deleteSelectedButton = new JButton(); label4 = new JLabel(); epcTextField = new JTextField(); deleteReadButton = new JButton(); label1 = new JLabel(); dataToStoreComboBox = new JComboBox<>(); deleteAllButton = new JButton(); allowDuplicateBibsCheckBox = new JCheckBox(); buttonBar = new JPanel(); closeButton = new JButton(); CellConstraints cc = new CellConstraints(); //======== this ======== setTitle(bundle.getString("JReadTags.this.title")); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setResizable(false);//from ww w . j a va 2 s . c om setIconImage( new ImageIcon(getClass().getResource("/com/tiempometa/resources/tiempometa_icon_large_alpha.png")) .getImage()); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== { dialogPane.setBorder(Borders.DIALOG_BORDER); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { contentPanel.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(Sizes.dluX(15)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(52)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(138)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(155)) }, new RowSpec[] { new RowSpec(Sizes.dluY(17)), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(20)), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(20)), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(25)), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- label2 ---- label2.setText(bundle.getString("JReadTags.label2.text")); label2.setFont(new Font("Tahoma", Font.PLAIN, 36)); contentPanel.add(label2, cc.xywh(3, 5, 3, 1)); //---- nextBibTextField ---- nextBibTextField.setFont(new Font("Tahoma", Font.PLAIN, 36)); nextBibTextField.setHorizontalAlignment(SwingConstants.RIGHT); nextBibTextField.setText(bundle.getString("JReadTags.nextBibTextField.text")); contentPanel.add(nextBibTextField, cc.xy(7, 5)); //---- statusLabel ---- statusLabel.setText(bundle.getString("JReadTags.statusLabel.text")); statusLabel.setHorizontalAlignment(SwingConstants.CENTER); statusLabel.setBackground(Color.yellow); statusLabel.setOpaque(true); statusLabel.setFont(new Font("Tahoma", Font.BOLD, 20)); contentPanel.add(statusLabel, cc.xywh(9, 3, 1, 5)); //---- startReadingButton ---- startReadingButton.setText(bundle.getString("JReadTags.startReadingButton.text")); startReadingButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); startReadingButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { startReadingButtonActionPerformed(e); } }); contentPanel.add(startReadingButton, cc.xywh(3, 7, 3, 1)); //---- bibLabel ---- bibLabel.setForeground(Color.red); bibLabel.setFont(new Font("Tahoma", Font.BOLD, 36)); bibLabel.setHorizontalAlignment(SwingConstants.CENTER); contentPanel.add(bibLabel, cc.xy(9, 9)); //======== scrollPane1 ======== { scrollPane1.setViewportView(tagReadTable); } contentPanel.add(scrollPane1, cc.xywh(3, 11, 7, 1)); //---- label3 ---- label3.setText(bundle.getString("JReadTags.label3.text")); label3.setHorizontalAlignment(SwingConstants.RIGHT); label3.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label3, cc.xy(3, 13)); //---- tidTextField ---- tidTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(tidTextField, cc.xy(5, 13)); //---- deleteSelectedButton ---- deleteSelectedButton.setText(bundle.getString("JReadTags.deleteSelectedButton.text")); deleteSelectedButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); deleteSelectedButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteSelectedButtonActionPerformed(e); } }); contentPanel.add(deleteSelectedButton, cc.xy(9, 13)); //---- label4 ---- label4.setText(bundle.getString("JReadTags.label4.text")); label4.setHorizontalAlignment(SwingConstants.RIGHT); label4.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label4, cc.xy(3, 15)); //---- epcTextField ---- epcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(epcTextField, cc.xy(5, 15)); //---- deleteReadButton ---- deleteReadButton.setText(bundle.getString("JReadTags.deleteReadButton.text")); deleteReadButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); deleteReadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteReadButtonActionPerformed(e); } }); contentPanel.add(deleteReadButton, cc.xy(9, 15)); //---- label1 ---- label1.setText(bundle.getString("JReadTags.label1.text")); label1.setHorizontalAlignment(SwingConstants.RIGHT); label1.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label1, cc.xy(3, 17)); //---- dataToStoreComboBox ---- dataToStoreComboBox.setModel(new DefaultComboBoxModel<>(new String[] { "EPC", "TID" })); dataToStoreComboBox.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(dataToStoreComboBox, cc.xy(5, 17)); //---- deleteAllButton ---- deleteAllButton.setText(bundle.getString("JReadTags.deleteAllButton.text")); deleteAllButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); deleteAllButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteAllButtonActionPerformed(e); } }); contentPanel.add(deleteAllButton, cc.xy(9, 17)); //---- allowDuplicateBibsCheckBox ---- allowDuplicateBibsCheckBox.setText(bundle.getString("JReadTags.allowDuplicateBibsCheckBox.text")); contentPanel.add(allowDuplicateBibsCheckBox, cc.xy(5, 19)); } dialogPane.add(contentPanel, BorderLayout.CENTER); //======== buttonBar ======== { buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER); buttonBar.setLayout( new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC }, RowSpec.decodeSpecs("pref"))); //---- closeButton ---- closeButton.setText("Cerrar"); closeButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { closeButtonActionPerformed(e); } }); buttonBar.add(closeButton, cc.xy(2, 1)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); setSize(710, 675); setLocationRelativeTo(getOwner()); // //GEN-END:initComponents }
From source file:com.digitexx.ancestry.gui.FrmUpperLowerData.java
private void initGUI() { try {/* w w w . j ava 2 s .c o m*/ this.setTitle("Uppercase & Lowercase data"); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); AnchorLayout thisLayout = new AnchorLayout(); getContentPane().setLayout(thisLayout); { panelMain = new JPanel(); BorderLayout panelMainLayout = new BorderLayout(); panelMain.setLayout(panelMainLayout); getContentPane().add(panelMain, new AnchorConstraint(0, 1000, 944, 0, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); panelMain.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); panelMain.setPreferredSize(new java.awt.Dimension(775, 488)); { splitPaneMain = new JSplitPane(); panelMain.add(splitPaneMain, BorderLayout.CENTER); splitPaneMain.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPaneMain.setDividerLocation(200); { panelColumnLog = new JPanel(); BorderLayout panelLogLayout = new BorderLayout(); panelColumnLog.setLayout(panelLogLayout); splitPaneMain.add(panelColumnLog, JSplitPane.RIGHT); panelColumnLog.setPreferredSize(new java.awt.Dimension(417, 482)); { splitPaneColumnAndLog = new JSplitPane(); panelColumnLog.add(splitPaneColumnAndLog, BorderLayout.CENTER); splitPaneColumnAndLog.setDividerLocation(200); { panelLog = new JPanel(); BorderLayout panelLogLayout1 = new BorderLayout(); panelLog.setLayout(panelLogLayout1); splitPaneColumnAndLog.add(panelLog, JSplitPane.RIGHT); { scrollPaneLog = new JScrollPane(); panelLog.add(scrollPaneLog, BorderLayout.CENTER); { textPaneLog = new JTextPane(); scrollPaneLog.setViewportView(textPaneLog); } } } { panelColumn = new JPanel(); BorderLayout panelColumnLayout = new BorderLayout(); panelColumn.setLayout(panelColumnLayout); splitPaneColumnAndLog.add(panelColumn, JSplitPane.LEFT); { scrollPaneColumn = new JScrollPane(); panelColumn.add(scrollPaneColumn, BorderLayout.CENTER); { tableField = new JTable() { @Override public boolean isCellEditable(int row, int column) { if (getColumnName(column).equals("Check")) { return true; } else { return false; } } @Override public Class<?> getColumnClass(int column) { if (getColumnName(column).equals("Check")) { return Boolean.class; } else { return super.getColumnClass(column); } } }; scrollPaneColumn.setViewportView(tableField); } } } } } { panelPath = new JPanel(); BorderLayout panelPathLayout = new BorderLayout(); panelPath.setLayout(panelPathLayout); splitPaneMain.add(panelPath, JSplitPane.LEFT); panelPath.setPreferredSize(new java.awt.Dimension(769, 316)); { scrollPanePath = new JScrollPane(); panelPath.add(scrollPanePath, BorderLayout.CENTER); { jListPath = new JList(); scrollPanePath.setViewportView(jListPath); jListPath.setFont(new java.awt.Font("Arial", 0, 14)); } } } } } { panelFooter = new JPanel(); AnchorLayout panelFooterLayout = new AnchorLayout(); getContentPane().add(panelFooter, new AnchorConstraint(944, 1000, 1000, 0, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); panelFooter.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); panelFooter.setLayout(panelFooterLayout); panelFooter.setPreferredSize(new java.awt.Dimension(775, 29)); { buttonRun = new JButton(); panelFooter.add(buttonRun, new AnchorConstraint(86, 998, 948, 890, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); buttonRun.setText("Run"); buttonRun.setFont(new java.awt.Font("Arial", 1, 16)); buttonRun.setPreferredSize(new java.awt.Dimension(83, 25)); buttonRun.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { buttonRunActionPerformed(evt); } }); } { checkboxRework = new JCheckBox(); panelFooter.add(checkboxRework, new AnchorConstraint(86, 155, 948, 3, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); checkboxRework.setText("Rework"); checkboxRework.setFont(new java.awt.Font("Arial", 1, 16)); checkboxRework.setForeground(new java.awt.Color(255, 0, 0)); checkboxRework.setPreferredSize(new java.awt.Dimension(118, 25)); checkboxRework.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { checkboxReworkActionPerformed(evt); } }); } } pack(); this.setSize(783, 551); AppUtility.centerFrame(this); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { exit(); } }); ; } catch (Exception e) { e.printStackTrace(); } }
From source file:net.sf.profiler4j.console.ProjectDialog.java
/** * This method initializes rulesTable/*from w ww. ja va 2s .co m*/ * * @return javax.swing.JTable */ private JTable getRulesTable() { if (rulesTable == null) { rulesTable = new JTable(); rulesTable.setModel(ruleTableModel); rulesTable.setRowMargin(4); rulesTable.setRowHeight(24); rulesTable.setFont(new Font("Monospaced", Font.PLAIN, 14)); TableColumn c; c = rulesTable.getColumnModel().getColumn(0); c.setMinWidth(300); c = rulesTable.getColumnModel().getColumn(1); c.setMinWidth(80); c.setMaxWidth(80); JComboBox editorCb = new JComboBox(); for (Rule.Action a : Rule.Action.values()) { editorCb.addItem(a); } c.setCellEditor(new DefaultCellEditor(editorCb)); c.setCellRenderer(new DefaultTableCellRenderer() { Font font = new Font("Monospaced", Font.BOLD, 13); @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); Rule.Action r = (Rule.Action) value; setHorizontalAlignment(CENTER); setFont(font); if (r == Rule.Action.ACCEPT) { setBackground(Color.GREEN); } else { setBackground(Color.RED); } if (isSelected) { setForeground(Color.YELLOW); } else { setForeground(Color.BLACK); } return this; } }); } return rulesTable; }
From source file:edu.ku.brc.specify.utilapps.RegisterApp.java
/** * /* www . ja va 2 s. c om*/ */ protected void createUI() { JTabbedPane tabbedPane = new JTabbedPane(); rp = new RegProcessor(); rp.processSQL(); tree = new JTree(rp.getRoot(INCL_ANON)); propsTable = new JTable(); tree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { fillPropsTable(); } }); tree.setCellRenderer(new MyTreeCellRenderer()); Component topComp = UIHelper.createScrollPane(tree); Component botComp = UIHelper.createScrollPane(propsTable); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComp, botComp); splitPane.setDividerLocation(0.5); splitPane.setOneTouchExpandable(true); splitPane.setLastDividerLocation(300); Dimension minimumSize = new Dimension(200, 400); topComp.setMinimumSize(minimumSize); botComp.setMinimumSize(minimumSize); tabbedPane.add("Registration", splitPane); final List<Pair<String, String>> trackDescPairs = rp.getTrackKeyDescPairs(); Vector<String> trkItems = new Vector<String>(); for (Pair<String, String> p : trackDescPairs) { trkItems.add(p.second); } //Collections.sort(trkItems); final JList list = new JList(trkItems); //pb.add(UIHelper.createScrollPane(list), cc.xy(1, 1)); list.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int inx = list.getSelectedIndex(); if (inx > -1) { fillUsageItemsList(trackDescPairs.get(inx).first); } } } }); tabbedPane.add("Reg Stats", getStatsPane("Registration", rp.getRegNumHash().values(), "register")); DefaultListModel model = new DefaultListModel(); trackItemsList = new JList(model); topComp = UIHelper.createScrollPane(list); botComp = UIHelper.createScrollPane(trackItemsList); splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComp, botComp); splitPane.setDividerLocation(0.5); splitPane.setOneTouchExpandable(true); topComp.setMinimumSize(minimumSize); botComp.setMinimumSize(minimumSize); splitPane.setDividerLocation(0.5); trackUsageHash = rp.getTrackCatsHash(); tabbedPane.add("Usage Tracking", splitPane); tabbedPane.add("User Stats", getStatsPane("Tracking", rp.getTrackIdHash().values(), "track")); add(tabbedPane, BorderLayout.CENTER); }
From source file:client.ui.FilePane.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./*from www.java 2 s . co m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { fileButtonPane = new JPanel(); uploadFileButton = new JButton(); downloadFileButton = new JButton(); deleteFileButton = new JButton(); renameFileButton = new JButton(); authorizationButton = new JButton(); jSeparator1 = new JSeparator(); addNoteButton = new JButton(); deleteNoteButton = new JButton(); jSeparator2 = new JSeparator(); targetIDField = new JTextField(); searchUserButton = new JButton(); returnButton = new JButton(); jSeparator3 = new JSeparator(); refreshButton = new JButton(); jSeparator4 = new JSeparator(); changePasswdButton = new JButton(); fileSplitPane = new JSplitPane(); jSplitPane2 = new JSplitPane(); fileInfoScroll = new JScrollPane(); fileInfoTable = new JTable(); noteDisplayScroll = new JScrollPane(); noteTable = new JTable(); jSplitPane1 = new JSplitPane(); fileDisplayScroll = new JScrollPane(); fileContentArea = new JTextArea(); noteInputScroll = new JScrollPane(); noteInputArea = new JTextArea(); FormListener formListener = new FormListener(); setForeground(new Color(240, 240, 240)); setFont(new Font("", 0, 12)); // NOI18N setMaximumSize(new Dimension(1366, 768)); setPreferredSize(new Dimension(1366, 700)); fileButtonPane.setMaximumSize(new Dimension(32767, 50)); fileButtonPane.setMinimumSize(new Dimension(404, 50)); uploadFileButton.setFont(new Font("", 0, 12)); // NOI18N uploadFileButton.setText(""); uploadFileButton.setActionCommand("JButton1"); uploadFileButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); uploadFileButton.setBorderPainted(false); uploadFileButton.setContentAreaFilled(false); uploadFileButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); uploadFileButton.setFocusPainted(false); uploadFileButton.setMaximumSize(new Dimension(30, 20)); uploadFileButton.setMinimumSize(new Dimension(30, 20)); uploadFileButton.addMouseListener(formListener); uploadFileButton.addActionListener(formListener); downloadFileButton.setFont(new Font("", 0, 12)); // NOI18N downloadFileButton.setText(""); downloadFileButton.setActionCommand("JButton1"); downloadFileButton.setBorder(null); downloadFileButton.setBorderPainted(false); downloadFileButton.setContentAreaFilled(false); downloadFileButton.setEnabled(false); downloadFileButton.setFocusPainted(false); downloadFileButton.setMaximumSize(new Dimension(30, 20)); downloadFileButton.setMinimumSize(new Dimension(30, 20)); downloadFileButton.setPreferredSize(new Dimension(30, 20)); downloadFileButton.addMouseListener(formListener); downloadFileButton.addActionListener(formListener); deleteFileButton.setFont(new Font("", 0, 12)); // NOI18N deleteFileButton.setText(""); deleteFileButton.setBorder(null); deleteFileButton.setBorderPainted(false); deleteFileButton.setContentAreaFilled(false); deleteFileButton.setEnabled(false); deleteFileButton.setFocusPainted(false); deleteFileButton.addMouseListener(formListener); deleteFileButton.addActionListener(formListener); renameFileButton.setFont(new Font("", 0, 12)); // NOI18N renameFileButton.setText("???"); renameFileButton.setBorder(null); renameFileButton.setBorderPainted(false); renameFileButton.setContentAreaFilled(false); renameFileButton.setEnabled(false); renameFileButton.setFocusPainted(false); renameFileButton.addMouseListener(formListener); renameFileButton.addActionListener(formListener); authorizationButton.setFont(new Font("", 0, 12)); // NOI18N authorizationButton.setText("??"); authorizationButton.setBorder(null); authorizationButton.setBorderPainted(false); authorizationButton.setContentAreaFilled(false); authorizationButton.setEnabled(false); authorizationButton.setFocusPainted(false); authorizationButton.addMouseListener(formListener); authorizationButton.addActionListener(formListener); jSeparator1.setOrientation(SwingConstants.VERTICAL); addNoteButton.setFont(new Font("", 0, 12)); // NOI18N addNoteButton.setText(""); addNoteButton.setActionCommand("JButton1"); addNoteButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); addNoteButton.setBorderPainted(false); addNoteButton.setContentAreaFilled(false); addNoteButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); addNoteButton.setEnabled(false); addNoteButton.setFocusPainted(false); addNoteButton.setMaximumSize(new Dimension(30, 20)); addNoteButton.setMinimumSize(new Dimension(30, 20)); addNoteButton.addMouseListener(formListener); addNoteButton.addActionListener(formListener); deleteNoteButton.setFont(new Font("", 0, 12)); // NOI18N deleteNoteButton.setText(""); deleteNoteButton.setActionCommand("JButton1"); deleteNoteButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); deleteNoteButton.setBorderPainted(false); deleteNoteButton.setContentAreaFilled(false); deleteNoteButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); deleteNoteButton.setEnabled(false); deleteNoteButton.setFocusPainted(false); deleteNoteButton.setMaximumSize(new Dimension(30, 20)); deleteNoteButton.setMinimumSize(new Dimension(30, 20)); deleteNoteButton.addMouseListener(formListener); deleteNoteButton.addActionListener(formListener); jSeparator2.setOrientation(SwingConstants.VERTICAL); targetIDField.setFont(new Font("", 0, 12)); // NOI18N searchUserButton.setFont(new Font("", 0, 12)); // NOI18N searchUserButton.setText(""); searchUserButton.setActionCommand("JButton1"); searchUserButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); searchUserButton.setBorderPainted(false); searchUserButton.setContentAreaFilled(false); searchUserButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); searchUserButton.setFocusPainted(false); searchUserButton.setMaximumSize(new Dimension(30, 20)); searchUserButton.setMinimumSize(new Dimension(30, 20)); searchUserButton.addMouseListener(formListener); searchUserButton.addActionListener(formListener); returnButton.setFont(new Font("", 0, 12)); // NOI18N returnButton.setText(""); returnButton.setActionCommand("JButton1"); returnButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); returnButton.setBorderPainted(false); returnButton.setContentAreaFilled(false); returnButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); returnButton.setFocusPainted(false); returnButton.setMaximumSize(new Dimension(30, 20)); returnButton.setMinimumSize(new Dimension(30, 20)); returnButton.addMouseListener(formListener); returnButton.addActionListener(formListener); jSeparator3.setOrientation(SwingConstants.VERTICAL); refreshButton.setFont(new Font("", 0, 12)); // NOI18N refreshButton.setText(""); refreshButton.setActionCommand("JButton1"); refreshButton.setBorder(null); refreshButton.setBorderPainted(false); refreshButton.setContentAreaFilled(false); refreshButton.setFocusPainted(false); refreshButton.setMaximumSize(new Dimension(30, 20)); refreshButton.setMinimumSize(new Dimension(30, 20)); refreshButton.setPreferredSize(new Dimension(30, 20)); refreshButton.addMouseListener(formListener); refreshButton.addActionListener(formListener); jSeparator4.setOrientation(SwingConstants.VERTICAL); changePasswdButton.setFont(new Font("", 0, 12)); // NOI18N changePasswdButton.setText("?"); changePasswdButton.setActionCommand("JButton1"); changePasswdButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); changePasswdButton.setBorderPainted(false); changePasswdButton.setContentAreaFilled(false); changePasswdButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); changePasswdButton.setFocusPainted(false); changePasswdButton.setMaximumSize(new Dimension(30, 20)); changePasswdButton.setMinimumSize(new Dimension(30, 20)); changePasswdButton.addMouseListener(formListener); changePasswdButton.addActionListener(formListener); GroupLayout fileButtonPaneLayout = new GroupLayout(fileButtonPane); fileButtonPane.setLayout(fileButtonPaneLayout); fileButtonPaneLayout.setHorizontalGroup(fileButtonPaneLayout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(fileButtonPaneLayout.createSequentialGroup() .addComponent(uploadFileButton, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(downloadFileButton, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(deleteFileButton, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(renameFileButton, GroupLayout.PREFERRED_SIZE, 57, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(authorizationButton, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(addNoteButton, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(deleteNoteButton, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(targetIDField, GroupLayout.PREFERRED_SIZE, 115, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(searchUserButton, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(returnButton, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(refreshButton, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator4, GroupLayout.PREFERRED_SIZE, 2, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(changePasswdButton, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE) .addContainerGap(18, Short.MAX_VALUE))); fileButtonPaneLayout.setVerticalGroup(fileButtonPaneLayout .createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, fileButtonPaneLayout.createSequentialGroup().addContainerGap().addGroup(fileButtonPaneLayout .createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(jSeparator4) .addGroup(fileButtonPaneLayout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addGroup(fileButtonPaneLayout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(changePasswdButton, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addGroup(fileButtonPaneLayout .createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(refreshButton, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addGroup(fileButtonPaneLayout .createParallelGroup( GroupLayout.Alignment.TRAILING, false) .addComponent(jSeparator2) .addGroup(fileButtonPaneLayout .createParallelGroup( GroupLayout.Alignment.BASELINE) .addComponent(addNoteButton, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addComponent(deleteNoteButton, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) .addComponent(jSeparator1) .addGroup(fileButtonPaneLayout .createParallelGroup( GroupLayout.Alignment.BASELINE) .addComponent(downloadFileButton, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addComponent(deleteFileButton, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addComponent(renameFileButton, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addComponent(authorizationButton, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addComponent(uploadFileButton, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) .addComponent(jSeparator3) .addGroup(GroupLayout.Alignment.LEADING, fileButtonPaneLayout.createParallelGroup( GroupLayout.Alignment.BASELINE) .addComponent(targetIDField) .addComponent(searchUserButton, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addComponent(returnButton, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))))))) .addGap(15, 15, 15))); fileSplitPane.setBackground(new Color(255, 255, 255)); fileSplitPane.setDividerLocation(750); fileSplitPane.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); fileSplitPane.setMaximumSize(new Dimension(1366, 768)); fileSplitPane.setPreferredSize(new Dimension(701, 646)); jSplitPane2.setDividerLocation(400); jSplitPane2.setOrientation(JSplitPane.VERTICAL_SPLIT); jSplitPane2.setContinuousLayout(true); jSplitPane2.setMaximumSize(new Dimension(1366, 768)); fileInfoScroll.setBackground(new Color(255, 255, 255)); fileInfoScroll.setFont(new Font("", 0, 12)); // NOI18N fileInfoScroll.getViewport().setBackground(Color.WHITE); fileInfoScroll.addMouseListener(formListener); fileInfoTable.setAutoCreateRowSorter(true); fileInfoTable.setFont(new Font("", 0, 12)); // NOI18N fileInfoTable.setModel(fileTableModel); fileInfoTable.getTableHeader().setFont(new Font("", 0, 12)); fileInfoTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); fileInfoTable.setRowHeight(20); fileInfoTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fileInfoTable.setShowHorizontalLines(false); fileInfoTable.setShowVerticalLines(false); fileInfoTable.addMouseListener(formListener); fileInfoTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { fileSelectedChanged(evt); } }); fileInfoScroll.setViewportView(fileInfoTable); jSplitPane2.setTopComponent(fileInfoScroll); noteDisplayScroll.setBackground(new Color(255, 255, 255)); noteDisplayScroll.setFont(new Font("", 0, 12)); // NOI18N noteDisplayScroll.getViewport().setBackground(Color.WHITE); noteDisplayScroll.addMouseListener(formListener); noteTable.setAutoCreateRowSorter(true); noteTable.setFont(new Font("", 0, 12)); // NOI18N noteTable.setModel(noteTableModel); noteTable.getTableHeader().setFont(new Font("", 0, 12)); noteTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); noteTable.setRowHeight(20); noteTable.setShowHorizontalLines(false); noteTable.setShowVerticalLines(false); noteTable.addMouseListener(formListener); noteTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { noteSelectedChanged(evt); } }); noteDisplayScroll.setViewportView(noteTable); jSplitPane2.setBottomComponent(noteDisplayScroll); fileSplitPane.setLeftComponent(jSplitPane2); jSplitPane1.setDividerLocation(500); jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT); fileDisplayScroll.setFont(new Font("", 0, 12)); // NOI18N fileDisplayScroll.setMinimumSize(new Dimension(30, 30)); fileContentArea.setEditable(false); fileContentArea.setColumns(20); fileContentArea.setFont(new Font("", 0, 12)); // NOI18N fileContentArea.setRows(5); fileContentArea.setToolTipText(""); fileContentArea .setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("", 0, 12))); // NOI18N fileDisplayScroll.setViewportView(fileContentArea); jSplitPane1.setTopComponent(fileDisplayScroll); noteInputScroll.setFont(new Font("", 0, 12)); // NOI18N noteInputScroll.setMaximumSize(new Dimension(1366, 768)); noteInputScroll.setMinimumSize(new Dimension(30, 30)); noteInputArea.setColumns(20); noteInputArea.setFont(new Font("", 0, 12)); // NOI18N noteInputArea.setRows(5); noteInputArea.setToolTipText(""); noteInputArea .setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("", 0, 12))); // NOI18N noteInputScroll.setViewportView(noteInputArea); jSplitPane1.setBottomComponent(noteInputScroll); fileSplitPane.setRightComponent(jSplitPane1); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(fileSplitPane, GroupLayout.DEFAULT_SIZE, 1346, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(fileButtonPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(fileButtonPane, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(fileSplitPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap())); }
From source file:ch.fork.AdHocRailway.ui.locomotives.configuration.LocomotiveConfig.java
private void initComponents() { nameTextField = BasicComponentFactory .createTextField(presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_NAME)); nameTextField.setColumns(30);/*from www . j a v a 2 s . c o m*/ descTextField = BasicComponentFactory .createTextField(presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_DESCRIPTION)); descTextField.setColumns(30); imageChoserPanel = new JPanel(new MigLayout("fill")); imageTextField = BasicComponentFactory .createTextField(presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_IMAGE)); imageTextField.setColumns(30); chooseImageButton = new JButton("Choose..."); chooseImageButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { chooseLocoImage(); } }); imageChoserPanel.add(imageTextField, "grow"); imageChoserPanel.add(chooseImageButton); imageLabel = new JLabel(); imageLabel.setHorizontalAlignment(SwingConstants.CENTER); imageLabel.setIcon(LocomotiveImageHelper.getLocomotiveIcon(presentationModel.getBean())); busSpinner = new JSpinner(); busSpinner.setModel(SpinnerAdapterFactory.createNumberAdapter( presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_BUS), 1, // defaultValue 0, // minValue 100, // maxValue 1)); // step address1Spinner = new JSpinner(); address1Spinner.setModel(SpinnerAdapterFactory.createNumberAdapter( presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_ADDRESS1), 1, // defaultValue 0, // minValue 324, // maxValue 1)); // step address2Spinner = new JSpinner(); address2Spinner.setModel(SpinnerAdapterFactory.createNumberAdapter( presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_ADDRESS2), 1, // defaultValue 0, // minValue 324, // maxValue 1)); // step final List<LocomotiveType> locomotiveTypes = Arrays.asList(LocomotiveType.values()); final ValueModel locomotiveTypeModel = presentationModel .getBufferedModel(Locomotive.PROPERTYNAME_LOCOMOTIVE_TYPE); locomotiveTypeComboBox = BasicComponentFactory .createComboBox(new SelectionInList<LocomotiveType>(locomotiveTypes, locomotiveTypeModel)); functions = new ArrayListModel<LocomotiveFunction>(presentationModel.getBean().getFunctions()); functionsTable = new JTable(); functionsModel = new SelectionInList<LocomotiveFunction>(); functionsModel.setList(functions); functionsTable.setModel(new LocomotiveFunctionTableModel(functionsModel)); functionsTable.getColumnModel().getColumn(0).setCellRenderer(new CenterRenderer()); errorPanel = new ErrorPanel(); validate(presentationModel.getBean(), null); presentationModel.getBean().addPropertyChangeListener(this); okButton = new JButton(new ApplyChangesAction()); cancelButton = new JButton(new CancelAction()); }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.AngleDirectController.java
/** * Initialize the main view./* www .j a v a 2 s. c om*/ */ private void initAngleDirectPanel() { // initialize the main view angleDirectPanel = new AngleDirectPanel(); // initialize the dataTable dataTable = new JTable(); JScrollPane scrollPane = new JScrollPane(dataTable); //the table will take all the viewport height available dataTable.setFillsViewportHeight(true); scrollPane.getViewport().setBackground(Color.white); dataTable.getTableHeader().setReorderingAllowed(false); //row selection must be false && column selection true to be able to select through columns dataTable.setColumnSelectionAllowed(true); dataTable.setRowSelectionAllowed(false); angleDirectPanel.getDataTablePanel().add(scrollPane); //create a ButtonGroup for the radioButtons used for analysis ButtonGroup radioButtonGroup = new ButtonGroup(); //adding buttons to a ButtonGroup automatically deselect one when another one gets selected radioButtonGroup.add(angleDirectPanel.getInstTurnAngleRadioButton()); radioButtonGroup.add(angleDirectPanel.getTrackTurnAngleRadioButton()); // radioButtonGroup.add(angleDirectPanel.getDynamicDirectRatioRadioButton()); // radioButtonGroup.add(angleDirectPanel.getEndPointDirectRatioRadioButton()); /** * Add action listeners */ // show instantaneous turning angles angleDirectPanel.getInstTurnAngleRadioButton().addActionListener((ActionEvent e) -> { PlateCondition currentCondition = singleCellPreProcessingController.getCurrentCondition(); //check that a condition is selected if (currentCondition != null) { showInstAngleInTable(currentCondition); plotHistTA(currentCondition); plotPolarTA(currentCondition); plotRoseTA(currentCondition); plotCompassTA(currentCondition); } }); // show and plot averaged-track turning angles angleDirectPanel.getTrackTurnAngleRadioButton().addActionListener((ActionEvent e) -> { PlateCondition currentCondition = singleCellPreProcessingController.getCurrentCondition(); //check that a condition is selected if (currentCondition != null) { showTrackAngleInTable(currentCondition); plotHistTrackTA(currentCondition); plotPolarTrackTA(currentCondition); plotRoseTrackTA(currentCondition); plotCompassTrackTA(currentCondition); } }); /** * */ angleDirectPanel.getSaveChartToPdfButton().addActionListener((ActionEvent e) -> { ChartPanel chartPanel = rosePlotChartPanels.get(2); JFreeChart chart = chartPanel.getChart(); if (chart != null) { try { // create the PDF report file createPdf(chart); } catch (IOException ex) { LOG.error(ex.getMessage(), ex); } } }); // // show dynamic directionality ratios // angleDirectPanel.getDynamicDirectRatioRadioButton().addActionListener((ActionEvent e) -> { // PlateCondition currentCondition = singleCellPreProcessingController.getCurrentCondition(); // //check that a condition is selected // if (currentCondition != null) { // // } // }); // // // show end-point directionality ratios // angleDirectPanel.getEndPointDirectRatioRadioButton().addActionListener((ActionEvent e) -> { // PlateCondition currentCondition = singleCellPreProcessingController.getCurrentCondition(); // //check that a condition is selected // if (currentCondition != null) { // // } // }); //select as default first button angleDirectPanel.getInstTurnAngleRadioButton().setSelected(true); // add view to parent panel singleCellPreProcessingController.getSingleCellAnalysisPanel().getAngleDirectParentPanel() .add(angleDirectPanel, gridBagConstraints); angleDirectPanel.getTurningAngleParentPanel().add(turningAnglePanel, gridBagConstraints); }
From source file:edu.ku.brc.specify.tasks.subpane.ESResultsTablePanel.java
/** * Constructor of a results "table" which is really a panel * @param esrPane the parent// w w w . ja v a 2 s . c o m * @param erTableInfo the info describing the results * @param installServices indicates whether services should be installed * @param isExpandedAtStartUp enough said * @param inclCloseBtn whether to include the close button on the bar */ public ESResultsTablePanel(final ExpressSearchResultsPaneIFace esrPane, final QueryForIdResultsIFace results, final boolean installServices, final boolean isExpandedAtStartUp, final boolean inclCloseBtn) { super(new BorderLayout()); this.esrPane = esrPane; this.results = results; this.bannerColor = results.getBannerColor(); this.isEditable = results.isEditingEnabled(); table = new JTable(); table.setShowVerticalLines(false); table.setRowSelectionAllowed(true); table.setSelectionMode(results.isMultipleSelection() ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION); setBackground(table.getBackground()); if (isEditable) { addContextMenu(); } topTitleBar = new GradiantLabel(results.getTitle(), SwingConstants.LEFT); topTitleBar.setBGBaseColor(bannerColor); topTitleBar.setTextColor(Color.WHITE); topTitleBar.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { expandBtn.doClick(); } } }); String description = results.getDescription(); if (StringUtils.isNotEmpty(description)) { topTitleBar.setToolTipText(description); } expandBtn = new TriangleButton(); expandBtn.setToolTipText(getResourceString("CollapseTBL")); expandBtn.setForeground(bannerColor); expandBtn.setTextColor(Color.WHITE); showTopNumEntriesBtn = new GradiantButton( String.format(getResourceString("ShowTopEntries"), new Object[] { topNumEntries })); showTopNumEntriesBtn.setForeground(bannerColor); showTopNumEntriesBtn.setTextColor(Color.WHITE); showTopNumEntriesBtn.setVisible(false); showTopNumEntriesBtn.setCursor(handCursor); List<ServiceInfo> services = installServices ? getServices() : null; //System.out.println("["+tableInfo.getTableId()+"]["+services.size()+"]"); StringBuffer colDef = new StringBuffer("p,0px,p:g,0px,p,0px,"); int numCols = (installServices ? services.size() : 0) + (inclCloseBtn ? 1 : 0); colDef.append(UIHelper.createDuplicateJGoodiesDef("p", "0px", numCols)); // add additional col defs for services PanelBuilder builder = new PanelBuilder(new FormLayout(colDef.toString(), "f:p:g")); CellConstraints cc = new CellConstraints(); int col = 1; builder.add(expandBtn, cc.xy(col, 1)); col += 2; builder.add(topTitleBar, cc.xy(col, 1)); col += 2; builder.add(showTopNumEntriesBtn, cc.xy(col, 1)); col += 2; if (installServices && services.size() > 0) { serviceBtns = new Hashtable<ServiceInfo, JButton>(); //IconManager.IconSize size = IconManager. int iconSize = AppPreferences.getLocalPrefs().getInt("banner.icon.size", 20); // Install the buttons on the banner with available services for (ServiceInfo serviceInfo : services) { GradiantButton btn = new GradiantButton(serviceInfo.getIcon(iconSize)); // XXX PREF btn.setToolTipText(serviceInfo.getTooltip()); btn.setForeground(bannerColor); builder.add(btn, cc.xy(col, 1)); ESTableAction esta = new ESTableAction(serviceInfo.getCommandAction(), table, serviceInfo.getTooltip()); esta.setProperty("gridtitle", results.getTitle()); btn.addActionListener(esta); serviceBtns.put(serviceInfo, btn); col += 2; } } GradiantButton closeBtn = null; if (inclCloseBtn) { closeBtn = new GradiantButton(IconManager.getIcon("Close")); closeBtn.setToolTipText(getResourceString("ESCloseTable")); closeBtn.setForeground(bannerColor); closeBtn.setRolloverEnabled(true); closeBtn.setRolloverIcon(IconManager.getIcon("CloseHover")); closeBtn.setPressedIcon(IconManager.getIcon("CloseHover")); builder.add(closeBtn, cc.xy(col, 1)); col += 2; } add(builder.getPanel(), BorderLayout.NORTH); tablePane = new JPanel(new BorderLayout()); setupTablePane(); if (isEditable) { //delRSItems = UIHelper.createI18NButton("RESTBL_DEL_ITEMS"); delRSItems = UIHelper.createIconBtn("DelRec", "ESDelRowsTT", null); delRSItems.addActionListener(createRemoveItemAL()); delRSItems.setEnabled(false); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { delRSItems.setEnabled(table.getSelectedRowCount() > 0); } } }); } add(tablePane, BorderLayout.CENTER); moveToRSCmd = new DragSelectedRowsBtn(IconManager.getIcon("Record_Set", IconManager.IconSize.Std16)); if (installServices) { PanelBuilder bottomBar = new PanelBuilder( new FormLayout("4px,p,4px,p,4px,p," + (delRSItems != null ? "4px,p," : "") + "f:p:g", "p")); bottomBar.add(moveToRSCmd, cc.xy(2, 1)); bottomBar.add(selectAllBtn, cc.xy(4, 1)); bottomBar.add(deselectAllBtn, cc.xy(6, 1)); if (delRSItems != null) { bottomBar.add(delRSItems, cc.xy(8, 1)); } botBtnPanel = bottomBar.getPanel(); deselectAllBtn.setEnabled(false); selectAllBtn.setEnabled(true); moveToRSCmd.setEnabled(true); deselectAllBtn.setToolTipText(getResourceString("SELALLTOOLTIP")); selectAllBtn.setToolTipText(getResourceString("DESELALLTOOLTIP")); moveToRSCmd.setToolTipText(getResourceString("MOVEROWSTOOLTIP")); selectAllBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { table.selectAll(); } }); deselectAllBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { table.clearSelection(); } }); moveToRSCmd.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { RecordSetIFace src = (RecordSetIFace) moveToRSCmd.getData(); CommandDispatcher .dispatch(new CommandAction(RecordSetTask.RECORD_SET, "AskForNewRS", src, null, null)); } }); add(botBtnPanel, BorderLayout.SOUTH); } else { botBtnPanel = null; } expandBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { expandTable(false); } }); if (!isExpandedAtStartUp) { expandTable(true); } showTopNumEntriesBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { morePanel.setVisible(true); showTopNumEntriesBtn.setVisible(false); showingAllRows = false; setDisplayRows(rowCount, topNumEntries); // If it is collapsed then expand it if (!expandBtn.isDown()) { tablePane.setVisible(true); expandBtn.setDown(true); } // Make sure the layout is updated invalidate(); doLayout(); esrPane.revalidateScroll(); } }); if (closeBtn != null) { closeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { removeMe(); } }); } }); } ResultSetTableModel rsm = createModel(); rsm.setPropertyListener(this); resultSetTableModel = rsm; table.setRowSorter(new TableRowSorter<ResultSetTableModel>(resultSetTableModel)); table.setRowSelectionAllowed(true); table.setModel(rsm); configColumns(); rowCount = rsm.getRowCount(); if (rowCount > topNumEntries + 2) { buildMorePanel(); setDisplayRows(rowCount, topNumEntries); } else { setDisplayRows(rowCount, Integer.MAX_VALUE); } invalidate(); doLayout(); UIRegistry.forceTopFrameRepaint(); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { if (botBtnPanel != null) { deselectAllBtn.setEnabled(table.getSelectedRowCount() > 0); selectAllBtn.setEnabled(table.getSelectedRowCount() != table.getRowCount()); moveToRSCmd.setEnabled(table.getSelectedRowCount() > 0); } } if (propChangeListener != null) { if (!e.getValueIsAdjusting()) { propChangeListener.propertyChange( new PropertyChangeEvent(this, "selection", table.getSelectedRowCount(), 0)); } else { propChangeListener.propertyChange( new PropertyChangeEvent(this, "selection", table.getSelectedRowCount(), 0)); } } } }); table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { //synchronized (((JTable)e.getSource()).getTreeLock()) //{ doDoubleClickOnRow(e); //} } }); // Horizontal Alignment is set later TableColumnModel tableColModel = table.getColumnModel(); for (int i = 0; i < tableColModel.getColumnCount(); i++) { tableColModel.getColumn(i).setCellRenderer(new BiColorTableCellRenderer()); } }
From source file:fll.scheduler.SchedulerUI.java
public SchedulerUI() { super(BASE_TITLE); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); _progressDialog = new ProgressDialog(SchedulerUI.this, "Please Wait"); _progressDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setJMenuBar(createMenubar());//from w w w. java 2s . com final Container cpane = getContentPane(); cpane.setLayout(new BorderLayout()); mTabbedPane = new JTabbedPane(); cpane.add(mTabbedPane, BorderLayout.CENTER); final JPanel scheduleDescriptionPanel = new JPanel(new BorderLayout()); mTabbedPane.addTab("Description", scheduleDescriptionPanel); mDescriptionFilename = new JLabel(""); scheduleDescriptionPanel.add(createDescriptionToolbar(), BorderLayout.PAGE_START); mScheduleDescriptionEditor = new SolverParamsEditor(); final JScrollPane editorScroller = new JScrollPane(mScheduleDescriptionEditor); scheduleDescriptionPanel.add(editorScroller, BorderLayout.CENTER); // start out with default values mScheduleDescriptionEditor.setParams(new SolverParams()); final JPanel schedulePanel = new JPanel(new BorderLayout()); mTabbedPane.addTab("Schedule", schedulePanel); mScheduleFilename = new JLabel(""); schedulePanel.add(createScheduleToolbar(), BorderLayout.PAGE_START); mScheduleTable = new JTable(); mScheduleTable.setAutoCreateRowSorter(true); mScheduleTable.setDefaultRenderer(Date.class, schedTableRenderer); mScheduleTable.setDefaultRenderer(String.class, schedTableRenderer); mScheduleTable.setDefaultRenderer(Integer.class, schedTableRenderer); mScheduleTable.setDefaultRenderer(Object.class, schedTableRenderer); final JScrollPane dataScroller = new JScrollPane(mScheduleTable); violationTable = new JTable(); violationTable.setDefaultRenderer(String.class, violationTableRenderer); violationTable.getSelectionModel().addListSelectionListener(violationSelectionListener); final JScrollPane violationScroller = new JScrollPane(violationTable); final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, dataScroller, violationScroller); schedulePanel.add(splitPane, BorderLayout.CENTER); // initial state mWriteSchedulesAction.setEnabled(false); mDisplayGeneralScheduleAction.setEnabled(false); mRunOptimizerAction.setEnabled(false); mReloadFileAction.setEnabled(false); pack(); }
From source file:com.vgi.mafscaling.ClosedLoop.java
private void createLogDataTable(JScrollPane dataScrollPane) { JPanel dataRunPanel = new JPanel(); dataScrollPane.setViewportView(dataRunPanel); GridBagLayout gbl_dataRunPanel = new GridBagLayout(); gbl_dataRunPanel.columnWidths = new int[] { 0 }; gbl_dataRunPanel.rowHeights = new int[] { 0 }; gbl_dataRunPanel.columnWeights = new double[] { 0.0 }; gbl_dataRunPanel.rowWeights = new double[] { 0.0 }; dataRunPanel.setLayout(gbl_dataRunPanel); logDataTable = new JTable(); logDataTable.getTableHeader().setReorderingAllowed(false); logDataTable.setModel(new DefaultTableModel(LogDataRowCount, ColumnCount)); logDataTable.setColumnSelectionAllowed(true); logDataTable.setCellSelectionEnabled(true); logDataTable.setBorder(new LineBorder(new Color(0, 0, 0))); logDataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); logDataTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); logDataTable.getColumnModel().getColumn(0).setHeaderValue("Time"); logDataTable.getColumnModel().getColumn(1).setHeaderValue("Load"); logDataTable.getColumnModel().getColumn(2).setHeaderValue("RPM"); logDataTable.getColumnModel().getColumn(3).setHeaderValue("MafV"); logDataTable.getColumnModel().getColumn(4).setHeaderValue("AFR"); logDataTable.getColumnModel().getColumn(5).setHeaderValue("STFT"); logDataTable.getColumnModel().getColumn(6).setHeaderValue("LTFT"); logDataTable.getColumnModel().getColumn(7).setHeaderValue("dV/dt"); logDataTable.getColumnModel().getColumn(8).setHeaderValue("IAT"); Utils.initializeTable(logDataTable, ColumnWidth); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 0, 0); gbc.anchor = GridBagConstraints.PAGE_START; gbc.gridx = 0;/* ww w . j a va 2s . c om*/ gbc.gridy = 0; dataRunPanel.add(logDataTable.getTableHeader(), gbc); gbc.gridy = 1; dataRunPanel.add(logDataTable, gbc); excelAdapter.addTable(logDataTable, true, false); }