stab(ResultSet k) { super("PATIENT FOUND"); String[] chd = { "Date", "Patient ID", "Name", "Gender", "Age", "Weight", "Address", "Contact No.", "Doctor Name", "Symptoms", "Dignosis", "Fee: Rs.", "Blood Group" }; // DefaultTableModel dtm=new DefaultTableModel(); // jt.setModel(new DefaultTableModel(arr,chd)); jt = new JTable(); jsp = new JScrollPane(jt); btn = new JButton("CLOSE"); btn.addActionListener(this); int i = 0; try { while (k.next()) { arr[i][0] = k.getString(1); // System.out.println("ddddddddddddd"+arr[i][0]); arr[i][1] = "" + k.getInt(2); arr[i][2] = k.getString(3) + " " + k.getString(4) + " " + k.getString(5); arr[i][3] = k.getString(6); arr[i][4] = "" + k.getInt(7); arr[i][5] = k.getString(8); arr[i][6] = k.getString(9); arr[i][7] = k.getString(10); arr[i][8] = k.getString(11); arr[i][9] = k.getString(12); arr[i][10] = k.getString(13); arr[i][11] = "" + k.getInt(14); arr[i][12] = k.getString(15); arr[i][13] = k.getString(16); // dtm.insertRow(i,new Object[]{patient.rs.getString(1), // patient.rs.getInt(2),patient.rs.getString(3)+patient.rs.getString(4)+patient.rs.getString(5),patient.rs.getString(6),patient.rs.getInt(7),patient.rs.getString(8),patient.rs.getString(9),patient.rs.getString(10),patient.rs.getString(11),patient.rs.getString(12),patient.rs.getString(13),patient.rs.getInt(14)}); i++; } } catch (Exception e12) { System.out.println("" + e12); } jt.setModel(new DefaultTableModel(arr, chd)); Container con = getContentPane(); con.setLayout(null); jsp.setBounds(20, 20, 1230, 600); btn.setBounds(685, 630, 100, 30); add(jsp); add(btn); setSize(1330, 800); setVisible(true); }
Customer() { super("Customer"); Container con; con = this.getContentPane(); con.setLayout(new FlowLayout()); labelCustNo = new JLabel("Customer Number"); labelCustName = new JLabel("Name"); labelCustSex = new JLabel("Sex"); labelCustAge = new JLabel("Age"); // Initializing textfield textCustNo = new JTextField(20); textCustName = new JTextField(25); textCustAge = new JTextField(2); String Sex[] = {"Male", "Female"}; comboCustSex = new JComboBox(Sex); // Adding controls for Customer Number con.add(labelCustNo); con.add(textCustNo); // Adding controls for Customer Name con.add(labelCustName); con.add(textCustName); // Adding controls for Customer Sex con.add(labelCustSex); con.add(comboCustSex); // Adding controls for Customer Age con.add(labelCustAge); con.add(textCustAge); // close the program when the close button is c l i c k e d setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(350, 250); show(); }
public static void main(String[] argv) throws NoSuchMethodException { f = new JFrame(); Container c = f.getContentPane(); c.setLayout(new BorderLayout()); c.add(new WordListScreen(null), BorderLayout.CENTER); f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); showFrame(true); }
public void init() { // <Begin_init> if (getParameter("RESOURCE_PROPERTIES") != null) { localePropertiesFileName = getParameter("RESOURCE_PROPERTIES"); } resourceBundle = com.adventnet.apiutils.Utility.getBundle( localePropertiesFileName, getParameter("RESOURCE_LOCALE"), applet); if (initialized) return; this.setSize(getPreferredSize().width + 495, getPreferredSize().height + 480); setTitle(resourceBundle.getString("ViewConfig")); Container container = getContentPane(); container.setLayout(new BorderLayout()); try { initVariables(); setUpGUI(container); setUpProperties(); setUpConnections(); } catch (Exception ex) { showStatus(resourceBundle.getString("Error in init method"), ex); } // let us set the initialized variable to true so // we dont initialize again even if init is called initialized = true; // <End_init> setTitle(resourceBundle.getString("View Configuration")); setIconImage(AuthMain.getBuilderUiIfInstance().getFrameIcon()); JLabel1.setIcon(AuthMain.getBuilderUiIfInstance().getImage("viewconfig.png")); com.adventnet.security.ui.ViewListCellRenderer ViewListCellRenderer1 = new com.adventnet.security.ui.ViewListCellRenderer(); JTable1.setDefaultRenderer(JTable1.getColumnClass(0), ViewListCellRenderer1); JLabel2.setIcon(AuthMain.getBuilderUiIfInstance().getImage("addview1.png")); JTable1.getCellEditor(0, 0) .getTableCellEditorComponent(JTable1, null, true, 0, 0) .setEnabled(false); DefaultCellEditor te = (DefaultCellEditor) JTable1.getCellEditor(0, 0); te.setClickCountToStart(10); JTable1.setCellEditor(te); JViewport vp = new JViewport(); JLabel lab = new JLabel(resourceBundle.getString("List of available views")); lab.setHorizontalAlignment((int) JLabel.CENTER_ALIGNMENT); lab.setForeground(Color.black); vp.setView(lab); AuthMain.getBuilderUiIfInstance().centerWindow(this); setData(); viewc = this; addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent we) { close(); } }); /* TableColumn col2 = JTable1.getColumnModel().getColumn(1); DefaultTableCellRenderer ren = new DefaultTableCellRenderer(); ren.setIcon(AuthMain.getBuilderUiIfInstance().getImage("task1.png")); col2.setCellRenderer(ren); col2.setMaxWidth(30); */ DefaultListSelectionModel selModel = new DefaultListSelectionModel(); selModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JTable1.setSelectionModel(selModel); }
public void makeGUI() { frm = new JFrame(); c = frm.getContentPane(); btnImport = new JButton("Import"); btnImport.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { secureImport(); } }); btnMove = new JButton("Move"); btnMove.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { secureMove(); } }); btnDelete = new JButton("Delete"); btnDelete.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { secureDelete(); } }); btnAnalyse = new JButton("Analyse"); btnAnalyse.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { secureAnalysis(); } }); tblItems = new JTable(store); tblItems.setRowSorter(tableSorter); tblItems.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblItems.setFillsViewportHeight(true); tblItems.getRowSorter().toggleSortOrder(Storage.COL_DATE); tblItems.addMouseListener( new MouseListener() { public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { tblItems.setRowSelectionInterval( e.getY() / tblItems.getRowHeight(), e.getY() / tblItems.getRowHeight()); } if (e.getClickCount() > 1 || e.getButton() == MouseEvent.BUTTON3) { int idx = tblItems.convertRowIndexToModel(tblItems.getSelectedRow()); secureExport(idx); } } public void mouseEntered(MouseEvent arg0) {} public void mouseExited(MouseEvent arg0) {} public void mousePressed(MouseEvent arg0) {} public void mouseReleased(MouseEvent arg0) {} }); txaStatus = new JTextArea(TXA_HEIGHT, TXA_WIDTH); txaStatus.setEditable(false); txaStatus.setBorder(BorderFactory.createTitledBorder("Status")); txaSearch = new JTextArea(4, TXA_WIDTH); txaSearch.setBorder(BorderFactory.createTitledBorder("Search")); txaSearch.addKeyListener( new KeyListener() { public void keyPressed(KeyEvent arg0) {} public void keyReleased(KeyEvent arg0) { filterBase(txaSearch.getText()); // EXPORT settings here, as in mass export (export everything) if (allowExport && txaSearch.getText().equalsIgnoreCase(CMD_EXPORT)) { // txaSearch.setText(""); if (JOptionPane.showConfirmDialog( frm, "Do you really want to export the whole secure base?", "Confirm Export", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) { totalExport(); } } // LOST X IMPORT asin look through the store for files not listed if (txaSearch.getText().equalsIgnoreCase(CMD_STOCKTAKE)) { for (int i = 0; i < storeLocs.size(); i++) { if (store.stockTake(i)) needsSave = true; } } } public void keyTyped(KeyEvent arg0) {} }); JPanel pnlTop = new JPanel(new GridLayout(1, 4)); JPanel pnlEast = new JPanel(new BorderLayout()); JPanel pnlCenterEast = new JPanel(new BorderLayout()); JScrollPane jspItems = new JScrollPane(tblItems); pnlTop.add(btnImport); pnlTop.add(btnMove); pnlTop.add(btnDelete); pnlTop.add(btnAnalyse); pnlCenterEast.add(txaStatus, BorderLayout.CENTER); pnlCenterEast.add(txaSearch, BorderLayout.NORTH); // pnlEast.add(pswPass, BorderLayout.NORTH); pnlEast.add(pnlCenterEast, BorderLayout.CENTER); c.setLayout(new BorderLayout()); c.add(pnlTop, BorderLayout.NORTH); c.add(pnlEast, BorderLayout.EAST); c.add(jspItems, BorderLayout.CENTER); frm.setContentPane(c); }
public ItensVendidos() { super("Itens Vendidos"); JButton imprimir; final DefaultTableModel modelo = new DefaultTableModel(); // constrói a tabela JTable tabela = new JTable(modelo); // Cria duas colunas modelo.addColumn("Código"); modelo.addColumn("Vendedor"); modelo.addColumn("Produto"); modelo.addColumn("Quantidade"); imprimir = new JButton("Imprimir"); imprimir.setBounds(100, 450, 30, 24); // exibe os dados da tabela MySQL // Conexao banco = new Conexao(); String retorno = "erro"; try { // Connection ExConn = (Connection) banco.abrirBDconn(); Class.forName("com.mysql.jdbc.Driver"); Connection conexao = DriverManager.getConnection("jdbc:mysql://localhost/banco", "root", ""); Statement stmt = conexao.createStatement(); // procedimentos para obter os dados de uma tabela String query = "SELECT * FROM venda2"; ResultSet rs = stmt.executeQuery(query); while (rs.next()) { int id = rs.getInt("idVendedor"); String nome = rs.getString("nomeVendedor"); String produto = rs.getString("produto"); int qtd = rs.getInt("qtd"); modelo.addRow(new Object[] {new Integer(id), nome, produto, new Integer(qtd)}); } // fim procedimento para obter os dados } catch (SQLException ex) { System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); } catch (Exception e) { System.out.println("Problemas ao tentar conectar com o banco de dados"); } // fim MySQL tabela.setPreferredScrollableViewportSize(new Dimension(350, 50)); Container c = getContentPane(); c.setLayout(new FlowLayout()); JScrollPane scrollPane = new JScrollPane(tabela); c.add(scrollPane); c.add(imprimir); setSize(400, 300); setVisible(true); }
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents dialogPane = new JPanel(); contentPanel = new JPanel(); panel4 = new JPanel(); label3 = new JLabel(); formattedTextField1 = new JFormattedTextField(); label4 = new JLabel(); textField2 = new JTextField(); tabbedPane1 = new JTabbedPane(); panel1 = new JPanel(); panel11 = new JPanel(); panel12 = new JPanel(); panel12a = new JPanel(); layeredPane2 = new JLayeredPane(); spinner13 = new JSpinner(); spinner14 = new JSpinner(); spinner15 = new JSpinner(); label28 = new JLabel(); panel13 = new JPanel(); panel14 = new JPanel(); label23 = new JLabel(); label24 = new JLabel(); label17 = new JLabel(); formattedTextField3 = new JFormattedTextField(); label18 = new JLabel(); checkBox3 = new JCheckBox(); panel2 = new JPanel(); panel5 = new JPanel(); panel6 = new JPanel(); layeredPane1 = new JLayeredPane(); spinner1 = new JSpinner(); spinner2 = new JSpinner(); spinner4 = new JSpinner(); spinner5 = new JSpinner(); spinner3 = new JSpinner(); label6 = new JLabel(); panel7 = new JPanel(); panel8 = new JPanel(); label7 = new JLabel(); textField1 = new JTextField(); label8 = new JLabel(); comboBox1 = new JComboBox(); label9 = new JLabel(); panel9 = new JPanel(); spinner8 = new JSpinner(); label10 = new JLabel(); comboBox3 = new JComboBox(); label11 = new JLabel(); checkBox2 = new JCheckBox(); panel3 = new JPanel(); layeredPane3 = new JLayeredPane(); spinner7 = new JSpinner(); label19 = new JLabel(); spinner9 = new JSpinner(); label20 = new JLabel(); spinner10 = new JSpinner(); label14 = new JLabel(); label12 = new JLabel(); spinner11 = new JSpinner(); spinner12 = new JSpinner(); label25 = new JLabel(); panel10 = new JPanel(); panel15 = new JPanel(); panel16 = new JPanel(); label1 = new JLabel(); spinner6 = new JSpinner(); label2 = new JLabel(); spinner16 = new JSpinner(); scrollPane3 = new JScrollPane(); table1 = new JTable(); buttonBar = new JPanel(); okButton = new JButton(); cancelButton = new JButton(); // ======== this ======== setTitle("edit Machining Workingstep"); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); // ======== dialogPane ======== { dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setLayout(new BorderLayout()); // ======== contentPanel ======== { contentPanel.setLayout(new GridBagLayout()); ((GridBagLayout) contentPanel.getLayout()).columnWidths = new int[] {0, 0, 0}; ((GridBagLayout) contentPanel.getLayout()).rowHeights = new int[] {0, 0, 0, 0}; ((GridBagLayout) contentPanel.getLayout()).columnWeights = new double[] {0.0, 1.0, 1.0E-4}; ((GridBagLayout) contentPanel.getLayout()).rowWeights = new double[] {0.0, 1.0, 0.0, 1.0E-4}; // ======== panel4 ======== { panel4.setLayout(new GridBagLayout()); ((GridBagLayout) panel4.getLayout()).columnWidths = new int[] {0, 100, 0}; ((GridBagLayout) panel4.getLayout()).rowHeights = new int[] {0, 0, 0, 0}; ((GridBagLayout) panel4.getLayout()).columnWeights = new double[] {0.0, 1.0, 1.0E-4}; ((GridBagLayout) panel4.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 1.0E-4}; // ---- label3 ---- label3.setText("Id: "); panel4.add( label3, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); // ---- formattedTextField1 ---- formattedTextField1.setFont(new Font("Berlin Sans FB", Font.PLAIN, 13)); formattedTextField1.setText("ID01 bottomAndSide"); panel4.add( formattedTextField1, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); // ---- label4 ---- label4.setText("its Feature:"); label4.setVisible(false); panel4.add( label4, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); // ---- textField2 ---- textField2.setText("Closed Pocket"); textField2.setVisible(false); panel4.add( textField2, new GridBagConstraints( 1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } contentPanel.add( panel4, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); // ======== tabbedPane1 ======== { // ======== panel1 ======== { panel1.setLayout(new GridBagLayout()); ((GridBagLayout) panel1.getLayout()).columnWidths = new int[] {0, 0}; ((GridBagLayout) panel1.getLayout()).rowHeights = new int[] {0, 0}; ((GridBagLayout) panel1.getLayout()).columnWeights = new double[] {0.0, 1.0E-4}; ((GridBagLayout) panel1.getLayout()).rowWeights = new double[] {0.0, 1.0E-4}; // ======== panel11 ======== { panel11.setLayout(new GridBagLayout()); ((GridBagLayout) panel11.getLayout()).columnWidths = new int[] {0, 0, 0}; ((GridBagLayout) panel11.getLayout()).rowHeights = new int[] {0, 0}; ((GridBagLayout) panel11.getLayout()).columnWeights = new double[] {0.0, 0.0, 1.0E-4}; ((GridBagLayout) panel11.getLayout()).rowWeights = new double[] {0.0, 1.0E-4}; // ======== panel12 ======== { panel12.setBorder(new EtchedBorder()); panel12.setLayout(new GridBagLayout()); ((GridBagLayout) panel12.getLayout()).columnWidths = new int[] {345, 0, 0}; ((GridBagLayout) panel12.getLayout()).rowHeights = new int[] {0, 340, 0}; ((GridBagLayout) panel12.getLayout()).columnWeights = new double[] {0.0, 0.0, 1.0E-4}; ((GridBagLayout) panel12.getLayout()).rowWeights = new double[] {0.0, 0.0, 1.0E-4}; // ======== panel12a ======== { panel12a.setBorder(new EtchedBorder()); panel12a.setLayout(new GridBagLayout()); ((GridBagLayout) panel12a.getLayout()).columnWidths = new int[] {340, 0}; ((GridBagLayout) panel12a.getLayout()).rowHeights = new int[] {340, 0}; ((GridBagLayout) panel12a.getLayout()).columnWeights = new double[] {0.0, 1.0E-4}; ((GridBagLayout) panel12a.getLayout()).rowWeights = new double[] {0.0, 1.0E-4}; // ======== layeredPane2 ======== { layeredPane2.setBorder(new EtchedBorder()); // ---- spinner13 ---- spinner13.setModel(new SpinnerNumberModel(0.5, 0.0, 10.0, 0.1)); layeredPane2.add(spinner13, JLayeredPane.DEFAULT_LAYER); spinner13.setBounds(260, 225, 44, spinner13.getPreferredSize().height); // ---- spinner14 ---- spinner14.setModel(new SpinnerNumberModel(0.5, 0.0, 10.0, 0.1)); layeredPane2.add(spinner14, JLayeredPane.DEFAULT_LAYER); spinner14.setBounds(135, 280, 44, spinner14.getPreferredSize().height); // ---- spinner15 ---- spinner15.setModel(new SpinnerNumberModel(10.0, 0.0, null, 1.0)); layeredPane2.add(spinner15, JLayeredPane.DEFAULT_LAYER); spinner15.setBounds(290, 120, 45, spinner15.getPreferredSize().height); // ---- label28 ---- label28.setIcon( new ImageIcon(getClass().getResource("/images/OperationBall.png"))); layeredPane2.add(label28, JLayeredPane.DEFAULT_LAYER); label28.setBounds(new Rectangle(new Point(0, 0), label28.getPreferredSize())); } panel12a.add( layeredPane2, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } panel12.add( panel12a, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); // ======== panel13 ======== { panel13.setLayout(new GridBagLayout()); ((GridBagLayout) panel13.getLayout()).columnWidths = new int[] {0, 0, 0}; ((GridBagLayout) panel13.getLayout()).rowHeights = new int[] {0, 0, 0, 0}; ((GridBagLayout) panel13.getLayout()).columnWeights = new double[] {0.0, 1.0, 1.0E-4}; ((GridBagLayout) panel13.getLayout()).rowWeights = new double[] {1.0, 0.0, 1.0, 1.0E-4}; // ======== panel14 ======== { panel14.setBorder(new EtchedBorder()); panel14.setLayout(new GridBagLayout()); ((GridBagLayout) panel14.getLayout()).columnWidths = new int[] {0, 0, 0}; ((GridBagLayout) panel14.getLayout()).rowHeights = new int[] {0, 0, 0, 0}; ((GridBagLayout) panel14.getLayout()).columnWeights = new double[] {0.0, 1.0, 1.0E-4}; ((GridBagLayout) panel14.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 1.0E-4}; // ---- label23 ---- label23.setText("Type: "); panel14.add( label23, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); // ---- label24 ---- label24.setText("Bottom and Side Rough Or Finish Milling"); panel14.add( label24, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); // ---- label17 ---- label17.setText("Id:"); panel14.add( label17, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); // ---- formattedTextField3 ---- formattedTextField3.setFont(new Font("Berlin Sans FB", Font.PLAIN, 13)); formattedTextField3.setText("ID02"); panel14.add( formattedTextField3, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); // ---- label18 ---- label18.setText("Coolant:"); panel14.add( label18, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); // ---- checkBox3 ---- checkBox3.setBorderPaintedFlat(true); checkBox3.setSelected(true); panel14.add( checkBox3, new GridBagConstraints( 1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } panel13.add( panel14, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); } panel12.add( panel13, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } panel11.add( panel12, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); } panel1.add( panel11, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } tabbedPane1.addTab("Operation", panel1); // ======== panel2 ======== { panel2.setLayout(new GridBagLayout()); ((GridBagLayout) panel2.getLayout()).columnWidths = new int[] {345, 0, 0}; ((GridBagLayout) panel2.getLayout()).rowHeights = new int[] {340, 0}; ((GridBagLayout) panel2.getLayout()).columnWeights = new double[] {0.0, 0.0, 1.0E-4}; ((GridBagLayout) panel2.getLayout()).rowWeights = new double[] {1.0, 1.0E-4}; // ======== panel5 ======== { panel5.setLayout(new GridBagLayout()); ((GridBagLayout) panel5.getLayout()).columnWidths = new int[] {0, 0, 0}; ((GridBagLayout) panel5.getLayout()).rowHeights = new int[] {0, 0}; ((GridBagLayout) panel5.getLayout()).columnWeights = new double[] {0.0, 1.0, 1.0E-4}; ((GridBagLayout) panel5.getLayout()).rowWeights = new double[] {0.0, 1.0E-4}; // ======== panel6 ======== { panel6.setBorder(new EtchedBorder()); panel6.setLayout(new GridBagLayout()); ((GridBagLayout) panel6.getLayout()).columnWidths = new int[] {340, 0}; ((GridBagLayout) panel6.getLayout()).rowHeights = new int[] {340, 0}; ((GridBagLayout) panel6.getLayout()).columnWeights = new double[] {0.0, 1.0E-4}; ((GridBagLayout) panel6.getLayout()).rowWeights = new double[] {0.0, 1.0E-4}; // ======== layeredPane1 ======== { layeredPane1.setBackground(Color.white); // ---- spinner1 ---- spinner1.setModel(new SpinnerNumberModel(80.0, 0.0, null, 1.0)); layeredPane1.add(spinner1, JLayeredPane.DEFAULT_LAYER); spinner1.setBounds(90, 225, 41, spinner1.getPreferredSize().height); // ---- spinner2 ---- spinner2.setModel(new SpinnerNumberModel(60.0, 0.0, null, 1.0)); layeredPane1.add(spinner2, JLayeredPane.DEFAULT_LAYER); spinner2.setBounds(200, 240, 36, spinner2.getPreferredSize().height); // ---- spinner4 ---- spinner4.setModel(new SpinnerNumberModel(20.0, 1.0, null, 1.0)); layeredPane1.add(spinner4, JLayeredPane.DEFAULT_LAYER); spinner4.setBounds(150, 320, 36, spinner4.getPreferredSize().height); // ---- spinner5 ---- spinner5.setModel(new SpinnerNumberModel(20.0, 0.0, null, 1.0)); layeredPane1.add(spinner5, JLayeredPane.DEFAULT_LAYER); spinner5.setBounds(150, 0, 40, 21); // ---- spinner3 ---- spinner3.setModel(new SpinnerNumberModel(70.0, 0.0, null, 1.0)); layeredPane1.add(spinner3, JLayeredPane.DEFAULT_LAYER); spinner3.setBounds(45, 160, 41, spinner3.getPreferredSize().height); // ---- label6 ---- label6.setIcon(new ImageIcon(getClass().getResource("/images/ballEndMill.png"))); layeredPane1.add(label6, JLayeredPane.DEFAULT_LAYER); label6.setBounds(new Rectangle(new Point(0, 0), label6.getPreferredSize())); } panel6.add( layeredPane1, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } panel5.add( panel6, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); // ======== panel7 ======== { panel7.setLayout(new GridBagLayout()); ((GridBagLayout) panel7.getLayout()).columnWidths = new int[] {0, 0, 0}; ((GridBagLayout) panel7.getLayout()).rowHeights = new int[] {0, 0, 0, 0}; ((GridBagLayout) panel7.getLayout()).columnWeights = new double[] {0.0, 1.0, 1.0E-4}; ((GridBagLayout) panel7.getLayout()).rowWeights = new double[] {1.0, 0.0, 1.0, 1.0E-4}; // ======== panel8 ======== { panel8.setBorder( new CompoundBorder(new TitledBorder("tool parameters"), Borders.DLU2_BORDER)); panel8.setLayout(new GridBagLayout()); ((GridBagLayout) panel8.getLayout()).columnWidths = new int[] {0, 0, 0, 0}; ((GridBagLayout) panel8.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0}; ((GridBagLayout) panel8.getLayout()).columnWeights = new double[] {0.0, 0.0, 1.0, 1.0E-4}; ((GridBagLayout) panel8.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4}; // ---- label7 ---- label7.setText("Name"); panel8.add( label7, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); // ---- textField1 ---- textField1.setText("ball end mill"); textField1.setFont(new Font("Berlin Sans FB", Font.PLAIN, 13)); panel8.add( textField1, new GridBagConstraints( 2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); // ---- label8 ---- label8.setText("Material"); panel8.add( label8, new GridBagConstraints( 1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); // ---- comboBox1 ---- comboBox1.setModel( new DefaultComboBoxModel( new String[] { "Carbide P-Class", "Carbide M-Class", "Carbide S-Class", "Carbide K-Class", "Carbide H-Class", "Carbide N-Class" })); panel8.add( comboBox1, new GridBagConstraints( 2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); // ---- label9 ---- label9.setText("N. Teeth"); panel8.add( label9, new GridBagConstraints( 1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); // ======== panel9 ======== { panel9.setLayout(new GridBagLayout()); ((GridBagLayout) panel9.getLayout()).columnWidths = new int[] {0, 0, 0}; ((GridBagLayout) panel9.getLayout()).rowHeights = new int[] {0, 0}; ((GridBagLayout) panel9.getLayout()).columnWeights = new double[] {0.0, 0.0, 1.0E-4}; ((GridBagLayout) panel9.getLayout()).rowWeights = new double[] {0.0, 1.0E-4}; // ---- spinner8 ---- spinner8.setModel(new SpinnerNumberModel(4, 1, 20, 1)); panel9.add( spinner8, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); } panel8.add( panel9, new GridBagConstraints( 2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); // ---- label10 ---- label10.setText("Sense"); panel8.add( label10, new GridBagConstraints( 1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); // ---- comboBox3 ---- comboBox3.setModel( new DefaultComboBoxModel( new String[] {"RIGHT_TOOL", "LEFT_TOOL", "NEUTRUM"})); panel8.add( comboBox3, new GridBagConstraints( 2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); // ---- label11 ---- label11.setText("Internal Cooling"); panel8.add( label11, new GridBagConstraints( 1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); panel8.add( checkBox2, new GridBagConstraints( 2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } panel7.add( panel8, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); } panel5.add( panel7, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } panel2.add( panel5, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); } tabbedPane1.addTab("Tool", panel2); // ======== panel3 ======== { panel3.setLayout(new GridBagLayout()); ((GridBagLayout) panel3.getLayout()).columnWidths = new int[] {0, 555, 0, 0}; ((GridBagLayout) panel3.getLayout()).rowHeights = new int[] {0, 0}; ((GridBagLayout) panel3.getLayout()).columnWeights = new double[] {1.0, 0.0, 1.0, 1.0E-4}; ((GridBagLayout) panel3.getLayout()).rowWeights = new double[] {1.0, 1.0E-4}; // ======== layeredPane3 ======== { // ---- spinner7 ---- spinner7.setModel(new SpinnerNumberModel(0.0, 0.0, null, 1.0)); layeredPane3.add(spinner7, JLayeredPane.DEFAULT_LAYER); spinner7.setBounds(310, 115, 50, spinner7.getPreferredSize().height); // ---- label19 ---- label19.setText("m/min"); layeredPane3.add(label19, JLayeredPane.DEFAULT_LAYER); label19.setBounds(365, 120, 50, label19.getPreferredSize().height); // ---- spinner9 ---- spinner9.setModel(new SpinnerNumberModel(0.0, 0.0, null, 1.0)); layeredPane3.add(spinner9, JLayeredPane.DEFAULT_LAYER); spinner9.setBounds(150, 95, 55, spinner9.getPreferredSize().height); // ---- label20 ---- label20.setText("mm/rot"); layeredPane3.add(label20, JLayeredPane.DEFAULT_LAYER); label20.setBounds(220, 100, 45, label20.getPreferredSize().height); // ---- spinner10 ---- spinner10.setModel(new SpinnerNumberModel(0, 0, null, 1)); layeredPane3.add(spinner10, JLayeredPane.DEFAULT_LAYER); spinner10.setBounds(315, 35, 60, spinner10.getPreferredSize().height); // ---- label14 ---- label14.setText("rpm"); layeredPane3.add(label14, JLayeredPane.DEFAULT_LAYER); label14.setBounds(380, 40, 35, label14.getPreferredSize().height); // ---- label12 ---- label12.setText("Cut Speed"); layeredPane3.add(label12, JLayeredPane.DEFAULT_LAYER); label12.setBounds(275, 100, 65, label12.getPreferredSize().height); // ---- spinner11 ---- spinner11.setModel(new SpinnerNumberModel(0.0, 0.0, null, 1.0)); layeredPane3.add(spinner11, JLayeredPane.DEFAULT_LAYER); spinner11.setBounds(425, 165, 46, spinner11.getPreferredSize().height); // ---- spinner12 ---- spinner12.setModel(new SpinnerNumberModel(0.0, 0.0, null, 1.0)); layeredPane3.add(spinner12, JLayeredPane.DEFAULT_LAYER); spinner12.setBounds(350, 225, 50, 20); // ---- label25 ---- label25.setIcon( new ImageIcon(getClass().getResource("/images/technologyBallEndMill.png"))); layeredPane3.add(label25, JLayeredPane.DEFAULT_LAYER); label25.setBounds(new Rectangle(new Point(0, 0), label25.getPreferredSize())); } panel3.add( layeredPane3, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); } tabbedPane1.addTab("Technology", panel3); // ======== panel10 ======== { panel10.setLayout(new GridBagLayout()); ((GridBagLayout) panel10.getLayout()).columnWidths = new int[] {96, 0, 0, 0}; ((GridBagLayout) panel10.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0}; ((GridBagLayout) panel10.getLayout()).columnWeights = new double[] {1.0, 0.0, 0.0, 1.0E-4}; ((GridBagLayout) panel10.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 1.0E-4}; // ======== panel15 ======== { panel15.setLayout(new GridBagLayout()); ((GridBagLayout) panel15.getLayout()).columnWidths = new int[] {0, 0, 0, 0}; ((GridBagLayout) panel15.getLayout()).rowHeights = new int[] {0, 0, 0, 0}; ((GridBagLayout) panel15.getLayout()).columnWeights = new double[] {1.0, 0.0, 1.0, 1.0E-4}; ((GridBagLayout) panel15.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 1.0E-4}; // ======== panel16 ======== { panel16.setLayout(new GridBagLayout()); ((GridBagLayout) panel16.getLayout()).columnWidths = new int[] {85, 58, 0}; ((GridBagLayout) panel16.getLayout()).rowHeights = new int[] {0, 0, 0}; ((GridBagLayout) panel16.getLayout()).columnWeights = new double[] {0.0, 0.0, 1.0E-4}; ((GridBagLayout) panel16.getLayout()).rowWeights = new double[] {0.0, 0.0, 1.0E-4}; // ---- label1 ---- label1.setText("Operation Time"); panel16.add( label1, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); // ---- spinner6 ---- spinner6.setModel(new SpinnerNumberModel(10.0, 0.0, null, 1.0)); panel16.add( spinner6, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); // ---- label2 ---- label2.setText("Operation Cost"); panel16.add( label2, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); // ---- spinner16 ---- spinner16.setModel(new SpinnerNumberModel(10.0, 0.0, null, 1.0)); panel16.add( spinner16, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } panel15.add( panel16, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); } panel10.add( panel15, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); // ======== scrollPane3 ======== { // ---- table1 ---- table1.setModel( new DefaultTableModel( new Object[][] {}, new String[] {"Select", "Workingstep Id", "Operation type"}) { Class<?>[] columnTypes = new Class<?>[] {Boolean.class, Object.class, Object.class}; @Override public Class<?> getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } }); table1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane3.setViewportView(table1); } panel10.add( scrollPane3, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); } tabbedPane1.addTab("Cost, Time & Relations", panel10); } contentPanel.add( tabbedPane1, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); } dialogPane.add(contentPanel, BorderLayout.CENTER); // ======== buttonBar ======== { buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); buttonBar.setLayout(new GridBagLayout()); ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 85, 80}; ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0, 0.0}; // ---- okButton ---- okButton.setText("OK"); buttonBar.add( okButton, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); // ---- cancelButton ---- cancelButton.setText("Cancel"); buttonBar.add( cancelButton, new GridBagConstraints( 2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
static String[] input(int d, int m, int y) { // input frame for schedule String[] out = new String[4]; // appointment info storage final String[] doctors = {"Dr. Whitehead", "Dr. Namie", "Dr. Liddell"}; final JFrame input = new JFrame("Make Appointment"); Container pane1; JPanel pan = new JPanel(null); JLabel doctor = new JLabel("Choose your Doctor:"); JLabel da = new JLabel("Date:"); /*JLabel day=new JLabel(Integer.toString(d)); JLabel mo=new JLabel("Month:"); JLabel month=new JLabel(Integer.toString(m)); JLabel ye=new JLabel("Year:"); JLabel year=new JLabel(Integer.toString(y));*/ JLabel time = new JLabel("Appointment Time:"); JButton submit = new JButton("Submit"); docName = new JComboBox(doctors); JSpinner timeSpinner = new JSpinner(new SpinnerDateModel()); JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "hh:mm a"); timeSpinner.setEditor(timeEditor); timeSpinner.setValue(new Date()); JSpinner dateSpinner = new JSpinner(new SpinnerDateModel()); JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(dateSpinner, "MMM/dd/yyyy"); dateSpinner.setEditor(dateEditor); dateSpinner.setValue(new Date()); input.setSize(330, 375); // Set size to 400x400 pixels pane1 = input.getContentPane(); pane1.setLayout(null); // Apply null layout pan.setLayout(new GridLayout(4, 2, 20, 50)); pane1.setSize((int) (input.getHeight() / 2), (int) (input.getWidth() / 2)); pane1.setLocation( input.getHeight() - ((int) (input.getHeight() / 2)), input.getWidth() - ((int) (input.getWidth() / 2))); // trying to center failed input.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // Close when X is clicked pane1.add(pan); // pan.add(ye); // pan.add(year); pan.add(da); pan.add(dateSpinner); pan.add(time); pan.add(timeSpinner); pan.add(doctor); pan.add(docName); pan.add(submit); submit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { fmain.setVisible(true); input.setVisible(false); } }); pan.setBounds(0, 0, 320, 335); input.setResizable(false); input.setVisible(true); return out; }
public static void main(String args[]) { // style that is necessary try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (UnsupportedLookAndFeelException e) { } // Standard preparation for a frame fmain = new JFrame("Schedule Appointments"); // Create and name frame fmain.setSize(330, 375); // Set size to 400x400 pixels pane = fmain.getContentPane(); pane.setLayout(null); // Apply null layout fmain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Close when X is clicked // controls and portions of Calendar lmonth = new JLabel("January"); lyear = new JLabel("Change year:"); cyear = new JComboBox(); prev = new JButton("<<"); next = new JButton(">>"); canc = new JButton("Cancel"); mcal = new DefaultTableModel() { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } }; Cal = new JTable(mcal); scal = new JScrollPane(Cal); pcal = new JPanel(null); canc.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); // action listeners for buttons and the like prev.addActionListener(new btnPrev_Action()); next.addActionListener(new btnNext_Action()); cyear.addActionListener(new cmbYear_Action()); Cal.addMouseListener(new mouseCont()); // Adding the elements to the pane pane.add(pcal); pcal.add(lmonth); pcal.add(cyear); pcal.add(prev); pcal.add(next); pcal.add(canc); pcal.add(scal); // Setting where the elements are on the pane pcal.setBounds(0, 0, 320, 335); lmonth.setBounds(160 - lmonth.getPreferredSize().width / 2, 25, 100, 25); canc.setBounds(10, 305, 80, 20); cyear.setBounds(215, 305, 100, 20); prev.setBounds(10, 25, 50, 25); next.setBounds(260, 25, 50, 25); scal.setBounds(10, 50, 300, 250); // Make frame visible fmain.setResizable(false); fmain.setVisible(true); // Inner workings for the day mechanism GregorianCalendar cal = new GregorianCalendar(); // Create calendar rday = cal.get(GregorianCalendar.DAY_OF_MONTH); // Get day rmonth = cal.get(GregorianCalendar.MONTH); // Get month ryear = cal.get(GregorianCalendar.YEAR); // Get year currentMonth = rmonth; // Match month and year currentYear = ryear; // Add days String[] days = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; // All of the days for (int i = 0; i < 7; i++) { mcal.addColumn(days[i]); } Cal.getParent().setBackground(Cal.getBackground()); // Set background // No resize/reorder Cal.getTableHeader().setResizingAllowed(false); Cal.getTableHeader().setReorderingAllowed(false); // Single cell selection Cal.setColumnSelectionAllowed(true); Cal.setRowSelectionAllowed(true); Cal.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // Set row/column count Cal.setRowHeight(38); mcal.setColumnCount(7); mcal.setRowCount(6); // Placing the dates in the cells for (int i = ryear - 100; i <= ryear + 100; i++) { cyear.addItem(String.valueOf(i)); } // Refresh calendar refreshCalendar(rmonth, ryear); // Refresh calendar }
public EditorServer(String fileName, String name, String desc) { super(); self = this; if (fileName == null || !loadDocument(fileName)) { clients = new Vector(); document = new EditorDocument(name, desc, "", System.currentTimeMillis()); try { // ascii code for first blue line... document.insertString(0, "·-·+·*=·x·\n", document.getStyle("line")); } catch (BadLocationException ble) { System.out.println("EditorServer->const: BadLocationException"); } paragraphs = new Paragraphs(document); lockManager = new LockManager(clients, document, paragraphs); highlights = new Highlights(lockManager, document); nextClientId = 1; } isAudioOptionSelected = false; // to avoid unecessary Audio - Text participant matching documentPanel = new DocumentPanel(); updateParagraphList(); clientsPanel = new ClientsPanel(); clientsPanel.updateClientList(); Icon clockIcon = getImageIcon("images/clock.gif"); Icon clockIcon2 = getImageIcon("images/clock2.gif"); startRTPrecording = new JButton("START RTP Recording", clockIcon); startRTPrecording.setRolloverIcon(clockIcon2); RecordingHandler recHandler = new RecordingHandler(self); startRTPrecording.addActionListener(recHandler); Icon stopIcon = getImageIcon("images/stop.gif"); stopRTPrecording = new JButton("STOP RTP recording", stopIcon); stopRTPrecording.setEnabled(false); stopRTPrecording.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { recorder.endRecording(); stopRTPrecording.setEnabled(false); startRTPrecording.setEnabled(true); } }); Container container = getContentPane(); container.setLayout(new FlowLayout()); container.add(startRTPrecording); container.add(stopRTPrecording); // JTabbedPane tabPane = new JTabbedPane() ; tabPane.add("Document", documentPanel); tabPane.add("Text Clients", clientsPanel); container.add(tabPane, BorderLayout.CENTER); setTitle("EditorServer"); setSize(new Dimension(800, 600)); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { lockManager.saveDocument(null, highlights, self); System.exit(0); } }); JMenuItem mnuSave = new JMenuItem("Save"); mnuSave.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser dialog = new JFileChooser(); dialog.addChoosableFileFilter( new MyFileFilter("Collabortive Document File (*.cde)", ".cde")); dialog.setAcceptAllFileFilterUsed(false); if (dialog.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) { lockManager.saveDocument(dialog.getSelectedFile().getPath(), highlights, self); } } }); JMenuItem mnuSaveXML = new JMenuItem("Save XML"); mnuSaveXML.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser dialog = new JFileChooser(); dialog.addChoosableFileFilter(new MyFileFilter("XML File (*.xml)", ".xml")); dialog.setAcceptAllFileFilterUsed(false); if (dialog.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) { lockManager.saveXML(dialog.getSelectedFile().getPath(), highlights, self); } } }); JMenu mnuFile = new JMenu("File"); mnuFile.add(mnuSave); mnuFile.add(mnuSaveXML); JMenuBar menu = new JMenuBar(); menu.add(mnuFile); setJMenuBar(menu); Thread backupThread = new Thread() { public void run() { while (1 == 1) { yield(); try { // sleep(1000) ; sleep(5 * 60 * 1000); lockManager.saveDocument(null, highlights, self); } catch (Exception e) { System.out.println("EditorServer: backupThread. error"); e.printStackTrace(); } } } }; backupThread.setDaemon(true); backupThread.start(); } // endof const WITHOUT audio profile maker
public RecorderDialog(EditorServer parent) { super(parent, true); setTitle("Recorder Info"); // fieldsPanel JPanel fieldsPanel = new JPanel(); GridBagLayout gbLayout = new GridBagLayout(); GridBagConstraints constraints; // Address/Port/TTL : constraints = new GridBagConstraints(); constraints.anchor = GridBagConstraints.EAST; constraints.insets = new Insets(5, 5, 0, 0); fieldsPanel.setLayout(gbLayout); JLabel AddPTTLabel = new JLabel("Address/Port/TTL :"); gbLayout.setConstraints(AddPTTLabel, constraints); fieldsPanel.add(AddPTTLabel, constraints); constraints = new GridBagConstraints(); constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.insets = new Insets(5, 5, 0, 5); constraints.weightx = 1.0D; addressPortTTL = new JTextField(25); addressPortTTL.setText("224.20.20.20/20002"); gbLayout.setConstraints(addressPortTTL, constraints); fieldsPanel.add(addressPortTTL, constraints); // Outputfile... constraints = new GridBagConstraints(); constraints.anchor = GridBagConstraints.EAST; constraints.insets = new Insets(5, 5, 0, 0); JLabel OFileLabel = new JLabel("Save file as... :"); gbLayout.setConstraints(OFileLabel, constraints); fieldsPanel.add(OFileLabel, constraints); constraints = new GridBagConstraints(); constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.insets = new Insets(5, 5, 0, 5); constraints.weightx = 1.0D; outFile = new JTextField(25); outFile.setText("Placebo.rtp"); gbLayout.setConstraints(outFile, constraints); fieldsPanel.add(outFile, constraints); // Recording time... constraints = new GridBagConstraints(); constraints.anchor = GridBagConstraints.EAST; constraints.insets = new Insets(5, 5, 0, 0); JLabel timeLabel = new JLabel("Recording time (in seconds) : "); gbLayout.setConstraints(timeLabel, constraints); fieldsPanel.add(timeLabel, constraints); constraints = new GridBagConstraints(); constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.insets = new Insets(5, 5, 0, 5); constraints.weightx = 1.0D; durationField = new JTextField(25); durationField.setText("2700"); gbLayout.setConstraints(durationField, constraints); fieldsPanel.add(durationField, constraints); // The buttons... JPanel buttonPanel = new JPanel(); JButton startRecordingButton = new JButton("Start Recording"); startRecordingButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent buttonPressed) { // startThread here !!! String apt = addressPortTTL.getText().trim(); String ofile = outFile.getText().trim(); String duration = durationField.getText().trim(); System.out.println( "\napt : *" + apt + "* ofile : *" + ofile + "* duration: *" + duration + "*"); long dur = new Integer(duration).intValue() * 1000; // turned into ms recorder = new Recorder(apt, ofile, dur); recorder.start(); document.resetStartTime(System.currentTimeMillis()); // close dialog Box dispose(); } // }); // endActionListener buttonPanel.add(startRecordingButton); Container dialogContainer = getContentPane(); dialogContainer.setLayout(new BorderLayout()); dialogContainer.add(fieldsPanel, BorderLayout.CENTER); dialogContainer.add(buttonPanel, BorderLayout.SOUTH); pack(); setLocationRelativeTo(parent); }
public JunctionLinkDataFrame(final JunctionLink jl) { super( jl.getCurrName() + " properties", false, // resizable false, // closable false, // maximizable true); // iconifiable // PSRender.onHold(); super.setBackground(back_color); super.addInternalFrameListener( new InternalFrameAdapter() { public void internalFrameActivated(InternalFrameEvent e) { reload(); SelectedObject.setSelectedObject(jl); } }); PSRender.moveToTop(jl.getBound(), 0.5); ml = jl; setLocation(50, 50); dataModelMain = new HeadTable(jl); tableMain = new JTable(dataModelMain); tableMain.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN); tableMain.setPreferredScrollableViewportSize(new Dimension(500, 20)); // tableMain.setBackground(back_color); // code TableColumn column_code = tableMain.getColumn("Code"); DefaultTableCellRenderer rendererCode = new DefaultTableCellRenderer(); rendererCode.setToolTipText("Enter new code for this path"); column_code.setCellRenderer(rendererCode); column_code.setCellEditor(new TextFieldEditor()); // name TableColumn column_name = tableMain.getColumn("Name"); LanguageButtonRender render_name = new LanguageButtonRender(); render_name.setToolTipText("Path name. Press for change name"); column_name.setCellRenderer(render_name); LanguageButtonEditor editor_name = new LanguageButtonEditor(new JCheckBox()); column_name.setCellEditor(editor_name); // junction 1 TableColumn column_junc_1 = tableMain.getColumn("Junction 1"); MLButtonRenderer rendererJunc_1 = new MLButtonRenderer(); rendererJunc_1.setToolTipText("Code of first Junction, click for open properties"); column_junc_1.setCellRenderer(rendererJunc_1); MLButtonEditor editorJunc = new MLButtonEditor(new JCheckBox()); column_junc_1.setCellEditor(editorJunc); // junction 2 TableColumn column_junc_2 = tableMain.getColumn("Junction 2"); MLButtonRenderer rendererJunc_2 = new MLButtonRenderer(); rendererJunc_2.setToolTipText("Code of second Junction, click for open properties"); column_junc_2.setCellRenderer(rendererJunc_2); column_junc_2.setCellEditor(editorJunc); // type JComboBox comboBoxType = new JComboBox(); String roadNames[] = jl.getTypeNames(); for (int i = 0, len = roadNames.length; i < len; i++) { comboBoxType.addItem(roadNames[i]); } TableColumn column_type = tableMain.getColumn("Type"); DefaultTableCellRenderer rendererType = new DefaultTableCellRenderer(); rendererType.setToolTipText("To change road type click for combo box"); column_type.setCellRenderer(rendererType); column_type.setCellEditor(new DefaultCellEditor(comboBoxType)); // legth TableColumn column_length = tableMain.getColumn("Length"); DefaultTableCellRenderer rendererLen = new DefaultTableCellRenderer(); rendererLen.setToolTipText("The path length in meters"); column_length.setCellRenderer(rendererLen); scrollpaneMain = new JScrollPane(tableMain); scrollpaneMain.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollpaneMain.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); scrollpaneMain.setPreferredSize(new Dimension(500, 50)); Container contentPane = super.getContentPane(); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); contentPane.setLayout(gridbag); c.ipady = 0; // make this component tall c.weightx = 0.5; c.gridwidth = 4; c.gridx = 0; c.gridy = 0; gridbag.setConstraints(scrollpaneMain, c); // scrollpaneMain.setBackground(back_color); // scrollpaneMain.setForeground(back_color); contentPane.add(scrollpaneMain); TableModel dataModelPoints = new PointTableModel(jl); tablePoints = new JTable(dataModelPoints); tablePoints.setPreferredScrollableViewportSize( new Dimension(200, dataModelPoints.getRowCount() * tablePoints.getRowHeight())); ListModel lm = new AbstractListModel() { public int getSize() { return 1000; } public Object getElementAt(int index) { return "" + index; } }; JList rowHeader = new JList(lm); rowHeader.setFixedCellWidth(20); rowHeader.setFixedCellHeight(tablePoints.getRowHeight()); // + tablePoints.getRowMargin()); rowHeader.setCellRenderer(new RowHeaderRenderer(tablePoints)); scrollPanePoints = new JScrollPane(tablePoints); scrollPanePoints.setWheelScrollingEnabled(true); scrollPanePoints.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPanePoints.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); int mh; if (dataModelPoints.getRowCount() * tablePoints.getRowHeight() > 100) { mh = 100; } else { mh = dataModelPoints.getRowCount() * tablePoints.getRowHeight(); } scrollPanePoints.setPreferredSize(new Dimension(200, mh)); scrollPanePoints.setRowHeaderView(rowHeader); c.ipadx = 200; c.weightx = 0.5; c.gridwidth = 3; c.gridx = 1; c.gridy = 1; gridbag.setConstraints(scrollPanePoints, c); // scrollPanePoints.setBackground(back_color); contentPane.add(scrollPanePoints); button_ok = new JButton("Ok"); button_ok.addActionListener(this); JPanel buttonPane = new JPanel(null); buttonPane.setPreferredSize(new Dimension(500, 100)); button_ok.setBounds(205, 40, 90, 40); buttonPane.add(button_ok); c.ipady = 10; // make this component tall c.ipadx = 10; c.weightx = 0.5; c.gridwidth = 4; c.gridx = 2; c.gridy = 2; gridbag.setConstraints(buttonPane, c); buttonPane.setBackground(back_color); contentPane.add(buttonPane); super.pack(); super.setVisible(true); // MapApplication.getDesktop().setSelectedFrame(this); }