public void initComponents() { login_center_panel.setLayout(new GridLayout(1, 2)); login_center_panel.setBackground(Constants.cl_blue); logout_passwort_label.setForeground(Color.WHITE); login_center_panel.add(logout_passwort_label); login_center_panel.add(logout_passwort_passwordfield); add(login_center_panel, BorderLayout.CENTER); /* BottomPanel */ login_bottom_panel.setBackground(Constants.cl_blue); logout_ok_button.addActionListener(this); logout_ok_button.addKeyListener(this); login_bottom_panel.add(logout_ok_button); logout_break_button.addActionListener(this); logout_break_button.addKeyListener(this); login_bottom_panel.add(logout_break_button); add(login_bottom_panel, BorderLayout.SOUTH); } // #initComponents
/** * Construtor da Janela Sair * * @param frame O frame da vez * @param mensagem A mensagem que será exibida */ public JanelaSair(String titulo, String mensagem) { Sound.play("alerta.wav"); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } acaoSelecionada = ""; Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); int screenHeight = d.height; int screenWidth = d.width; setLocation(screenWidth / 2 - 245 / 2, screenHeight / 2 - 123 / 2); setSize(245, 123); setTitle(titulo); setLayout(null); setModal(true); setResizable(false); label = new JLabel(mensagem); label.setBounds(55, 18, 280, 15); icone = new JLabel(new ImageIcon("Resource/Icones/aviso.gif")); icone.setBounds(10, 10, 32, 32); salvar = new JButton("Sim"); salvar.setBounds(65, 50, 55, 25); salvar.addActionListener(this); naoSalvar = new JButton("Não"); naoSalvar.setBounds(129, 50, 55, 25); naoSalvar.addActionListener(this); getContentPane().add(label); getContentPane().add(icone); getContentPane().add(salvar); getContentPane().add(naoSalvar); addWindowListener(this); salvar.addKeyListener(this); naoSalvar.addKeyListener(this); setVisible(true); }
/** Construtor da classe */ @SuppressWarnings("static-access") public JanelaSegmentacaoAdaptativa() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } dimensao = 0; setSize(200, 180); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(d.width / 2 - 200 / 2, d.height / 2 - 180 / 2); setDefaultCloseOperation(this.DISPOSE_ON_CLOSE); setTitle("Segmentação Adaptativa"); setLayout(null); setModal(true); setResizable(false); informar = new JLabel("Informar"); informar.setBounds(10, 18, 100, 20); label = new JLabel("Limiar para Dimensão:"); label.setBounds(10, 50, 170, 20); label2 = new JLabel("(Valor maior que 0)"); label2.setBounds(15, 70, 170, 20); text = new JTextField(); text.setBounds(150, 50, 35, 20); ok = new JButton("OK"); ok.setBounds(20, 110, 57, 25); ok.addActionListener(this); cancelar = new JButton("Cancelar"); cancelar.setBounds(90, 110, 85, 25); cancelar.addActionListener(this); ajuda = new AjudaButton(); ajuda.setActionCommand("?"); ajuda.setLocation(170, 0); ajuda.addActionListener(this); getContentPane().add(informar); getContentPane().add(label); getContentPane().add(label2); getContentPane().add(text); getContentPane().add(ok); getContentPane().add(cancelar); getContentPane().add(ajuda); text.setText(""); dimensao = -1; text.addKeyListener(this); ok.addKeyListener(this); cancelar.addKeyListener(this); ajuda.addKeyListener(this); setVisible(true); }
public Btns(int x, int y) { this.setSize(x, y); this.setLayout(new FlowLayout()); this.add(pause); this.add(start); pause.addActionListener(this); start.addActionListener(this); pause.addKeyListener(this); start.addKeyListener(this); this.setFocusable(true); }
private JButton createButton(String text, String eventid, String shortcut, boolean def) { final JButton b = new JButton(text); b.setMaximumSize(new Dimension(80, b.getPreferredSize().height)); b.setPreferredSize(new Dimension(80, b.getPreferredSize().height)); b.setMinimumSize(new Dimension(80, b.getPreferredSize().height)); b.setActionCommand(eventid); b.addActionListener(this); b.setMnemonic(shortcut.charAt(0)); if ((shortcut != null) && (shortcut.length() > 0)) { this.eventKeyMap.put(Character.valueOf(shortcut.charAt(0)), eventid); } if (def) { getRootPane().setDefaultButton(b); b.requestFocus(); addWindowListener( new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { b.requestFocusInWindow(); } }); } b.addKeyListener(this.keyListener); SubstanceThemeHelper.setComponentToGeneralArea(b); return b; }
/** Creates new form LogIn */ public LogIn() { initComponents(); btnLogIn.addKeyListener( new KeyAdapter() { @Override public void keyReleased(KeyEvent ke) { if (ke.getKeyCode() == KeyEvent.VK_ENTER) { btnLogIn.doClick(); } } }); txtfldUserName.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { txtfldPassword.requestFocus(); } }); txtfldPassword.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { btnLogIn.requestFocus(); } }); this.setAlwaysOnTop(true); this.setResizable(false); this.setLocationRelativeTo(null); }
/** @return the contents of the window as a Component */ private Component makeContents() { JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); _label = new JLabel("Photo popup"); mainPanel.add(_label, BorderLayout.NORTH); _photoThumb = new PhotoThumbnail(false); // specify not in details panel _photoThumb.setPreferredSize(new Dimension(300, 300)); mainPanel.add(_photoThumb, BorderLayout.CENTER); // Close button at bottom JPanel okPanel = new JPanel(); okPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton(I18nManager.getText("button.ok")); okButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { _frame.dispose(); } }); okButton.addKeyListener( new KeyListener() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { _frame.dispose(); } } public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e) {} }); okPanel.add(okButton); mainPanel.add(okPanel, BorderLayout.SOUTH); return mainPanel; }
public void addFields() { // gbc.fill = GridBagConstraints.HORIZONTAL; gbc.ipadx = 20; content.add(new JLabel("Host", JLabel.CENTER), gbc); gbc.gridy++; content.add(new JLabel("Database", JLabel.CENTER), gbc); gbc.gridy++; content.add(new JLabel("Table", JLabel.CENTER), gbc); gbc.gridy++; content.add(new JLabel("Username", JLabel.CENTER), gbc); gbc.gridy++; content.add(new JLabel("Password", JLabel.CENTER), gbc); gbc.gridy = 0; gbc.gridx = 1; content.add(host, gbc); gbc.gridy++; content.add(database, gbc); gbc.gridy++; content.add(table, gbc); gbc.gridy++; content.add(username, gbc); gbc.gridy++; content.add(password, gbc); gbc.gridy++; login.setMnemonic(KeyEvent.VK_L); ActionListener act = new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getSource() == login) { if (username.getText().length() > 0) alive = false; else { showMessage("Username required", "At least enter a username :)"); } } if (e.getSource() == exit) { System.exit(0); } } }; login.addActionListener(act); exit.addActionListener(act); JPanel p = new JPanel(new FlowLayout()); p.add(login); p.add(exit); gbc.gridx = 0; gbc.gridwidth = 2; content.add(p, gbc); username.addKeyListener(this); password.addKeyListener(this); login.addKeyListener(this); }
/** * This method initializes jButtonCancelar * * <p>return javax.swing.JButton */ private JButton getJButtonCancelar() { if (jButtonCancelar == null) { jButtonCancelar = new JHighlightButton(); jButtonCancelar.setText("Cancelar"); jButtonCancelar.setBackground(new java.awt.Color(226, 226, 222)); jButtonCancelar.setIcon( new javax.swing.ImageIcon( getClass().getResource("/com/becoblohm/cr/gui/resources/icons/ix16x16/delete2.png"))); jButtonCancelar.addKeyListener(this); } return jButtonCancelar; }
/** * Contrutor da janela para requantizar uma imagem * * @param i A imagem a ser requantizada */ public JanelaDecomposicao() { this.setLayout(null); this.setSize(485, 200); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(d.width / 2 - 485 / 2, d.height / 2 - 200 / 2); this.setTitle("Decomposição de Canais"); this.setModal(true); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); createAndShowGUI(); buttonOk.addKeyListener(this); buttonCancel.addKeyListener(this); buttonAjuda.addKeyListener(this); rgb.addKeyListener(this); cmy.addKeyListener(this); cmyk.addKeyListener(this); hsl.addKeyListener(this); hsv.addKeyListener(this); ycrcb.addKeyListener(this); xyz.addKeyListener(this); this.setVisible(true); }
private void addBottomButtons(GridBagConstraints mainPanelConstraints) { JPanel bottomPanel = new JPanel(); bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.LINE_AXIS)); bottomPanel.add(Box.createHorizontalGlue()); JButton moreInfo = new JButton("More Info"); moreInfo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { BrowserLauncher.openURL("http://www.jpedal.org/builds.php"); } catch (IOException e1) { } } }); JButton close = new JButton("Close"); close.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); setVisible(false); } }); close.setPreferredSize(moreInfo.getPreferredSize()); bottomPanel.add(close); bottomPanel.add(Box.createRigidArea(new Dimension(5, 0))); setFocusTraversalPolicy(new MyFocus(getFocusTraversalPolicy(), moreInfo)); moreInfo.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent event) {} public void keyPressed(KeyEvent event) { if (event.getKeyCode() == 10) { try { BrowserLauncher.openURL("http://www.jpedal.org/builds.php"); } catch (IOException e1) { } } } public void keyReleased(KeyEvent event) {} }); bottomPanel.add(moreInfo); add(bottomPanel, mainPanelConstraints); }
private JButton createHeaderPopupCornerButton(final JPopupMenu headerPopup) { final JButton cornerButton = new JButton(Icons.getIcon(GeneralIcons.HIDE_COLUMN)); cornerButton.setToolTipText(Bundle.ReferencesBrowserControllerUI_ShowHideColumnsString()); cornerButton.setDefaultCapable(false); if (UIUtils.isWindowsClassicLookAndFeel()) { cornerButton.setMargin(new Insets(0, 0, 2, 2)); } else if (UIUtils.isWindowsXPLookAndFeel()) { cornerButton.setMargin(new Insets(0, 0, 0, 1)); } else if (UIUtils.isMetalLookAndFeel()) { cornerButton.setMargin(new Insets(0, 0, 2, 1)); } cornerButton.addKeyListener( new KeyAdapter() { public void keyPressed(final KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_SPACE) { showColumnSelectionPopup(headerPopup, cornerButton); } } }); cornerButton.addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent mouseEvent) { if (headerPopup.isVisible()) { internalCornerButtonClick = true; cornerButton.getModel().setArmed(false); } else { internalCornerButtonClick = false; if (mouseEvent.getModifiers() == InputEvent.BUTTON3_MASK) { showColumnSelectionPopup(headerPopup, cornerButton); } } } public void mouseClicked(MouseEvent mouseEvent) { if ((mouseEvent.getModifiers() == InputEvent.BUTTON1_MASK) && (!internalCornerButtonClick)) { showColumnSelectionPopup(headerPopup, cornerButton); } } }); return cornerButton; }
public Interractive_GUI(Control control) { super(); this.control = control; manual_control_enable = new JButton("Enable manual Controls"); manual_control_disable = new JButton("Disable Manual Controls"); if (control.isVehicleConnected()) { } else { } layout = new SpringLayout(); this.setLayout(layout); this.add(manual_control_enable); layout.putConstraint(SpringLayout.WEST, manual_control_enable, 50, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, manual_control_enable, 50, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.EAST, manual_control_enable, -50, SpringLayout.EAST, this); this.add(manual_control_disable); layout.putConstraint(SpringLayout.WEST, manual_control_disable, 50, SpringLayout.WEST, this); layout.putConstraint( SpringLayout.NORTH, manual_control_disable, 50, SpringLayout.SOUTH, manual_control_enable); layout.putConstraint(SpringLayout.EAST, manual_control_disable, -50, SpringLayout.EAST, this); errorLabel = new JLabel(); this.add(errorLabel); errorLabel.setText("lllll"); layout.putConstraint(SpringLayout.WEST, errorLabel, 50, SpringLayout.WEST, this); layout.putConstraint( SpringLayout.NORTH, errorLabel, 50, SpringLayout.SOUTH, manual_control_disable); layout.putConstraint(SpringLayout.EAST, errorLabel, -50, SpringLayout.EAST, this); layout.putConstraint(SpringLayout.SOUTH, errorLabel, 5, SpringLayout.SOUTH, this); // control.addVehicleListener(this); listener = new InterractiveListener(); manual_control_enable.addActionListener(listener); manual_control_disable.addActionListener(listener); this.setFocusable(true); this.setEnabled(true); buttonListener = new ButtonListener(); manual_control_enable.addKeyListener(buttonListener); // this.addKeyListener(buttonListener); }
public void init() { keyboard = new Keyboard(); CheckBoxChange checkBoxChange = new CheckBoxChange(); // build input begin ------------------ sendStringsCheckBox = new JCheckBox(); sendStringsCheckBox.setName("send strings"); JButton keyboardButton = new JButton( "<html><body><table><tr><td align=\"center\">click here</td></tr><tr><td align=\"center\">for keyboard</td></tr><tr><td align=\"center\">control.</td></tr></table></body></html>"); display.add(keyboardButton, gc); keyboardButton.addKeyListener(keyboard); ++gc.gridx; display.add(sendStringsCheckBox, gc); ++gc.gridx; display.add(new JLabel("send strings"), gc); currentLog = new JList(logModel); currentLog.setFixedCellWidth(400); currentLog.addListSelectionListener(this); currentLog.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); currentLog.setVisibleRowCount(10); TitledBorder title; JPanel logPanel = new JPanel(); JScrollPane logScrollPane = new JScrollPane(currentPlayers); title = BorderFactory.createTitledBorder("key log"); logPanel.setBorder(title); logPanel.add(logScrollPane); gc.gridx = 0; gc.gridwidth = 3; ++gc.gridy; display.add(logPanel, gc); JScrollPane currentFiltersScrollPane2 = new JScrollPane(currentLog); logPanel.add(currentFiltersScrollPane2); sendStringsCheckBox.addChangeListener(checkBoxChange); }
/** * This method initializes jButton * * @return javax.swing.JButton */ private JButton getOkButton() { if (okButton == null) { okButton = new JButton(); okButton.setBounds(179, 89, 79, 22); okButton.setText("Ok"); okButton.addKeyListener( new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent e) { // NeptusLog.pub().info("<###>keyPressed()"); if (e.getKeyCode() == KeyEvent.VK_ENTER) okAction(); } }); okButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { // NeptusLog.pub().info("<###>actionPerformed()"); okAction(); } }); } return okButton; }
public LanName(NetworkController nc, LanGraph l) { lan = l; controller = nc; oldname = l.getName(); jtfname = new JTextField(oldname); jtfname.addKeyListener(this); jtfname.setFocusable(true); addWindowListener(new NameWa()); addKeyListener(this); add(BorderLayout.CENTER, jtfname); JButton ok = new JButton(Build.messages.getString("ok")); ok.setActionCommand("ok"); ok.addActionListener(this); ok.addKeyListener(this); add(BorderLayout.SOUTH, ok); doLayout(); pack(); setAlwaysOnTop(true); setVisible(true); }
public PanelPeliculas() { super(new BorderLayout()); peliculaDAO = new PeliculaDAO(); iconos = new Iconos(); add(panelCentral(), BorderLayout.CENTER); add(panelPortada(), BorderLayout.WEST); ControladorEventos controladorEventos = new ControladorEventos(); jtbl_peliculas.addKeyListener(controladorEventos); jtbl_peliculas.addMouseListener(controladorEventos); jtbl_peliculas.addMouseListener(new JButtonTableClick(jtbl_peliculas)); jbtn_buscar.addActionListener(controladorEventos); jbtn_buscar.addKeyListener(controladorEventos); jbtn_agregar.addActionListener(controladorEventos); jtf_buscar.addKeyListener(controladorEventos); peliculaDAO.agregarObservador(controladorEventos); dialogoPelicula = null; }
/** Implemetation of inherited method. Returns the layouted content panel of the form */ public JPanel showFormContent() { JPanel root = getRootPanel(); // inherited if (myBranches.length == 0) { Gui.my_forms[index].setPreferredSize(new Dimension(300, 200)); JPanel noresultPanel = getNoResultPanel( Gui.lang.getString("no_branches_avail"), Gui.lang.getString("list_branches")); // inherited root.add(noresultPanel, "1,1,3,1,FULL,FULL"); } else { int border = 3; double size[][] = { { border, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, border }, // Columns { border, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, border } }; // Rows TableLayout tl = new TableLayout(size); tl.setHGap(border); tl.setVGap(border); JPanel panel = new JPanel(tl); panel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(BevelBorder.LOWERED), Gui.lang.getString("list_branches"))); Object[][] tableData = new Object[myBranches.length][3]; for (int i = 0; i < myBranches.length; i++) { tableData[i][0] = new Boolean(false); tableData[i][1] = ((Branch) myBranches[i]).getDescription(); tableData[i][2] = ((Branch) myBranches[i]).getAbbreviation(); } // Show Statistics int displayed; if (myBranches.length < 100) displayed = myBranches.length; else displayed = 100; String stat_string = (Gui.lang.getString("results") + " : " + myBranches.length); JLabel stats = FormElement.getInfiniteLabel(stat_string, Font.PLAIN, null); panel.add(stats, "1,1,4,1,LEFT,CENTER"); branchTable = new JTable(new ResultTableModel(tableData)); branchTable.setColumnModel(getColumnModel()); branchTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); branchTable.addMouseListener(this); JPanel sroot = new JPanel(new BorderLayout()); JScrollPane sp = new JScrollPane(branchTable); sp.setPreferredSize(new Dimension(300, 300)); sroot.add(sp, BorderLayout.CENTER); panel.add(sroot, "1,2,4,2,FULL,TOP"); selectAll = new JCheckBox(Gui.lang.getString("select_all")); selectAll.setToolTipText(Gui.lang.getString("select_all")); selectAll.setActionCommand("select_all"); selectAll.addActionListener(this); panel.add(selectAll, "1,3,1,3,LEFT,CENTER"); JButton new_button = FormElement.getButton("new", "images/branch2.png", null, null, true); new_button.setActionCommand("new_branch"); new_button.addActionListener(this); new_button.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent event) { if (event.getKeyCode() == KeyEvent.VK_ESCAPE) actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "cancel")); if (event.getKeyCode() == KeyEvent.VK_ENTER) actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "new_branch")); } }); panel.add(new_button, "3,3,3,3,FULL,CENTER"); JButton content_button = FormElement.getButton("content", "images/content.png", "branch_content", null, true); content_button.setActionCommand("branch_content"); content_button.addActionListener(this); content_button.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent event) { if (event.getKeyCode() == KeyEvent.VK_ESCAPE) actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "cancel")); if (event.getKeyCode() == KeyEvent.VK_ENTER) actionPerformed( new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "branch_content")); } }); panel.add(content_button, "4,3,4,3,FULL,CENTER"); JButton checkout_button = FormElement.getButton("checkout", "images/checkout2.png", null, null, true); checkout_button.setActionCommand("checkout"); checkout_button.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent event) { if (event.getKeyCode() == KeyEvent.VK_ESCAPE) actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "cancel")); if (event.getKeyCode() == KeyEvent.VK_ENTER) actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "checkout")); } }); checkout_button.addActionListener(this); panel.add(checkout_button, "3,4,3,4,FULL,CENTER"); JButton edit_button = FormElement.getButton("edit", "images/searchedit.png", null, null, true); edit_button.setActionCommand("edit"); edit_button.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent event) { if (event.getKeyCode() == KeyEvent.VK_ESCAPE) actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "cancel")); if (event.getKeyCode() == KeyEvent.VK_ENTER) actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "edit")); } }); edit_button.addActionListener(this); panel.add(edit_button, "4,4,4,4,FULL,CENTER"); /* JButton delete_button = FormElement.getButton("delete", "images/delete.png", null, null, true); delete_button.setActionCommand("delete"); delete_button.addActionListener(this); delete_button.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent event) { if (event.getKeyCode() == KeyEvent.VK_ESCAPE ) actionPerformed(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,"cancel")); if (event.getKeyCode() == KeyEvent.VK_ENTER) actionPerformed(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,"delete")); } }); panel.add(delete_button, "4,5,4,5,FULL,CENTER"); */ root.add(panel, "1,1,3,1,CENTER,CENTER"); } // Ok-Button JButton ok_button = FormElement.getButton("close", "images/ok.png", null, null, true); ok_button.setActionCommand("cancel"); ok_button.addActionListener(this); ok_button.addKeyListener(this); root.add(ok_button, "1,2,3,2,CENTER,CENTER"); return root; }
/** ************************************************* */ private JPanel getGebuehren() { // 1 2 3 4 5 6 7 FormLayout lay = new FormLayout( "10dlu,fill:0:grow(0.50),right:80dlu,10dlu,80dlu,fill:0:grow(0.50),10dlu", // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 "15dlu,p,10dlu,p,2dlu,p,2dlu,p,2dlu,p, 10dlu, p, 20dlu, p ,20dlu"); PanelBuilder pb = new PanelBuilder(lay); CellConstraints cc = new CellConstraints(); try { pb.getPanel().setOpaque(false); pb.addLabel("Bitte die Positionen auswählen die Sie berechnen wollen", cc.xyw(2, 2, 4)); pb.addLabel("Heilmittel 1", cc.xy(3, 4)); String lab = (String) vecaktrez.get(48); leistung[0] = new JRtaCheckBox((lab.equals("") ? "----" : lab)); leistung[0].setOpaque(false); if (!lab.equals("")) { leistung[0].setSelected(true); } else { leistung[0].setSelected(false); leistung[0].setEnabled(false); } pb.add(leistung[0], cc.xyw(5, 4, 2)); pb.addLabel("Heilmittel 2", cc.xy(3, 6)); lab = (String) vecaktrez.get(49); leistung[1] = new JRtaCheckBox((lab.equals("") ? "----" : lab)); leistung[1].setOpaque(false); if (!lab.equals("")) { } else { leistung[1].setSelected(false); leistung[1].setEnabled(false); } pb.add(leistung[1], cc.xyw(5, 6, 2)); pb.addLabel("Heilmittel 3", cc.xy(3, 8)); lab = (String) vecaktrez.get(50); leistung[2] = new JRtaCheckBox((lab.equals("") ? "----" : lab)); leistung[2].setOpaque(false); if (!lab.equals("")) { } else { leistung[2].setSelected(false); leistung[2].setEnabled(false); } pb.add(leistung[2], cc.xyw(5, 8, 2)); pb.addLabel("Heilmittel 4", cc.xy(3, 10)); lab = (String) vecaktrez.get(51); leistung[3] = new JRtaCheckBox((lab.equals("") ? "----" : lab)); leistung[3].setOpaque(false); if (!lab.equals("")) { } else { leistung[3].setSelected(false); leistung[3].setEnabled(false); } pb.add(leistung[3], cc.xyw(5, 10, 2)); /* pb.addLabel("Eintragen in Memo",cc.xy(3, 12)); leistung[4] = new JRtaCheckBox("Fehldaten"); leistung[4].setOpaque(false); leistung[4].setSelected(true); pb.add(leistung[4],cc.xyw(5, 12, 2)); */ uebernahme = new JButton("Kopie erstellen"); uebernahme.setActionCommand("uebernahme"); uebernahme.addActionListener(this); uebernahme.addKeyListener(this); pb.add(uebernahme, cc.xy(3, 14)); abbrechen = new JButton("abbrechen"); abbrechen.setActionCommand("abbrechen"); abbrechen.addActionListener(this); abbrechen.addKeyListener(this); pb.add(abbrechen, cc.xy(5, 14)); pb.getPanel().validate(); } catch (Exception ex) { ex.printStackTrace(); } return pb.getPanel(); }
/** * Make the UI for this widget. * * @param floatToolBar true if the toolbar should be floatable * @return UI as a Component */ private JComponent doMakeContents(boolean floatToolBar) { String imgp = "/auxdata/ui/icons/"; KeyListener listener = new KeyAdapter() { public void keyPressed(KeyEvent e) { if ((e.getSource() instanceof JComboBox)) { return; } int code = e.getKeyCode(); char c = e.getKeyChar(); if ((code == KeyEvent.VK_RIGHT) || (code == KeyEvent.VK_KP_RIGHT)) { if (e.isShiftDown()) { gotoIndex(anime.getNumSteps() - 1); } else { actionPerformed(CMD_FORWARD); } } else if ((code == KeyEvent.VK_LEFT) || (code == KeyEvent.VK_KP_LEFT)) { if (e.isShiftDown()) { gotoIndex(0); } else { actionPerformed(CMD_BACKWARD); } } else if (code == KeyEvent.VK_ENTER) { actionPerformed(CMD_STARTSTOP); } else if ((code == KeyEvent.VK_P) && e.isControlDown()) { actionPerformed(CMD_PROPS); } else if (Character.isDigit(c)) { int step = new Integer("" + c).intValue() - 1; if (step < 0) { step = 0; } if (step >= anime.getNumSteps()) { step = anime.getNumSteps() - 1; } gotoIndex(step); } } }; List buttonList = new ArrayList(); buttonList.add(timesCbx); // Update the list of times setTimesInTimesBox(); Dimension preferredSize = timesCbx.getPreferredSize(); if (preferredSize != null) { int height = preferredSize.height; if (height < 50) { JComponent filler = GuiUtils.filler(3, height); buttonList.add(filler); } } String[][] buttonInfo = { {"Go to first frame", CMD_BEGINNING, getIcon("Rewind")}, {"One frame back", CMD_BACKWARD, getIcon("StepBack")}, {"Run/Stop", CMD_STARTSTOP, getIcon("Play")}, {"One frame forward", CMD_FORWARD, getIcon("StepForward")}, {"Go to last frame", CMD_END, getIcon("FastForward")}, {"Properties", CMD_PROPS, getIcon("Information")} }; for (int i = 0; i < buttonInfo.length; i++) { JButton btn = GuiUtils.getScaledImageButton(buttonInfo[i][2], getClass(), 2, 2); btn.setToolTipText(buttonInfo[i][0]); btn.setActionCommand(buttonInfo[i][1]); btn.addActionListener(this); btn.addKeyListener(listener); // JComponent wrapper = GuiUtils.center(btn); // wrapper.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); btn.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); buttonList.add(btn); // buttonList.add(wrapper); if (i == 2) { startStopBtn = btn; } } JComponent contents = GuiUtils.hflow(buttonList, 1, 0); if (boxPanel == null) { boxPanel = new AnimationBoxPanel(this); if (timesArray != null) { updateBoxPanel(timesArray); } } boxPanel.addKeyListener(listener); if (!getBoxPanelVisible()) { boxPanel.setVisible(false); } contents = GuiUtils.doLayout(new Component[] {boxPanel, contents}, 1, GuiUtils.WT_Y, GuiUtils.WT_N); // GuiUtils.addKeyListenerRecurse(listener,contents); if (floatToolBar) { JToolBar toolbar = new JToolBar(JToolBar.HORIZONTAL); toolbar.setFloatable(true); contents = GuiUtils.left(contents); toolbar.add(contents); contents = toolbar; } updateRunButton(); madeContents = true; return contents; }
private void createComponents() { Box box0 = Box.createVerticalBox(); Box box1 = Box.createVerticalBox(); Box box2 = Box.createVerticalBox(); Box box3 = Box.createHorizontalBox(); Box box4 = Box.createVerticalBox(); Box box5 = Box.createHorizontalBox(); lMonitor = new JLabel(rb.getString("lbl_folder")); // lMonitor.setAlignmentX(Component.CENTER_ALIGNMENT); // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); lClearFolder = new JLabel(rb.getString("lbl_clear_folder")); lTimer = new JLabel(rb.getString("lbl_timer")); jTxtFolderMonitorName = new JTextField(props.getProperty(Property.MONITORFOLDER), 20); jTxtFolderMonitorName.addActionListener(new MyActionListener(ComponentID.TXTF_FOLDER)); jTxtFolderMonitorName.addKeyListener(new MyKeyListener()); jTxtFolderMonitorName.addFocusListener(new MyFocusListener(ComponentID.TXTF_FOLDER)); jTxtTimer = new JTextField(props.getProperty(Property.TIMER), 20); jTxtTimer.addActionListener(new MyActionListener(ComponentID.TXTF_TIMER)); jTxtTimer.addKeyListener(new MyKeyListener()); jTxtTimer.addFocusListener(new MyFocusListener(ComponentID.TXTF_TIMER)); JCheckBox jCBClearFolder = new JCheckBox(); jCBClearFolder.addActionListener(new MyActionListener(ComponentID.CHK_CLEAR_FOLDER)); jCBClearFolder.addKeyListener(new MyKeyListener()); buttonPanel = new JPanel(); buttonPanel.setBorder(new TitledBorder(new EtchedBorder(), rb.getString("brd_monitor_button"))); jbnStop = new JButton(rb.getString("b_stop")); jbnStop.setMnemonic(KeyEvent.VK_P); jbnStart = new JButton(rb.getString("b_start")); jbnStart.setMnemonic(KeyEvent.VK_S); buttonPanel.add(jbnStart); buttonPanel.add(jbnStop); jbnStop.addActionListener(new MyActionListener(ComponentID.B_STOP)); jbnStop.addKeyListener(new MyKeyListener()); jbnStart.addActionListener(new MyActionListener(ComponentID.B_START)); jbnStart.addKeyListener(new MyKeyListener()); box0.add(lMonitor); box0.add(Box.createVerticalStrut(10)); box0.add(lClearFolder); box0.add(Box.createVerticalStrut(10)); box0.add(lTimer); box1.add(jTxtFolderMonitorName); box1.setAlignmentX(LEFT_ALIGNMENT); box1.add(jCBClearFolder); box1.add(jTxtTimer); // box1.setBorder(new BevelBorder(BevelBorder.LOWERED)); box3.add(box0); box3.add(Box.createHorizontalStrut(10)); box3.add(box1); // box3.add(box2); // box4.add(box3); // box4.setBorder(new BevelBorder(BevelBorder.LOWERED)); // box4.add(box1); box5.add(box3); box5.add(Box.createHorizontalStrut(10)); // box5.setBorder(new BevelBorder(BevelBorder.LOWERED)); box5.add(buttonPanel); container.add(box5); ControlWindowMenuBar cwm = new ControlWindowMenuBar(); Property.getInstance().addPropertyChangeListener(Property.RESOURCEBUNDLE, cwm); Property.getInstance().addPropertyChangeListener(Property.RESOURCEBUNDLE, new MyKeyListener()); setJMenuBar(cwm); }
/** * Called by constructors to initialize the dialog. * * @since ostermillerutils 1.00.00 */ @Override protected void dialogInit() { if (labels == null) { setLocale(Locale.getDefault()); } name = new JTextField("", 20); pass = new JPasswordField("", 20); okButton = new JButton(labels.getString("dialog.ok")); cancelButton = new JButton(labels.getString("dialog.cancel")); nameLabel = new JLabel(labels.getString("dialog.name") + " "); passLabel = new JLabel(labels.getString("dialog.pass") + " "); super.dialogInit(); KeyListener keyListener = (new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE || (e.getSource() == cancelButton && e.getKeyCode() == KeyEvent.VK_ENTER)) { pressed_OK = false; PasswordDialog.this.setVisible(false); } if (e.getSource() == okButton && e.getKeyCode() == KeyEvent.VK_ENTER) { pressed_OK = true; PasswordDialog.this.setVisible(false); } } }); addKeyListener(keyListener); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == name) { // the user pressed enter in the name field. name.transferFocus(); } else { // other actions close the dialog. pressed_OK = (source == pass || source == okButton); PasswordDialog.this.setVisible(false); } } }; GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); c.insets.top = 5; c.insets.bottom = 5; JPanel pane = new JPanel(gridbag); pane.setBorder(BorderFactory.createEmptyBorder(10, 20, 5, 20)); c.anchor = GridBagConstraints.EAST; gridbag.setConstraints(nameLabel, c); pane.add(nameLabel); gridbag.setConstraints(name, c); name.addActionListener(actionListener); name.addKeyListener(keyListener); pane.add(name); c.gridy = 1; gridbag.setConstraints(passLabel, c); pane.add(passLabel); gridbag.setConstraints(pass, c); pass.addActionListener(actionListener); pass.addKeyListener(keyListener); pane.add(pass); c.gridy = 2; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.CENTER; JPanel panel = new JPanel(); okButton.addActionListener(actionListener); okButton.addKeyListener(keyListener); panel.add(okButton); cancelButton.addActionListener(actionListener); cancelButton.addKeyListener(keyListener); panel.add(cancelButton); gridbag.setConstraints(panel, c); pane.add(panel); getContentPane().add(pane); pack(); }
/** Setup the GUI. */ private void setupGUI() { JPanel mainPanel = new JPanel(); this.setContentPane(mainPanel); // start layout mainPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 2, 5); JLabel valueLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.value.label")); this.add(valueLabel, gbc); gbc.gridx = 1; gbc.gridy = 0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1; valueField = new JTextField(); valueField.setInputVerifier( new InputVerifier() { @Override public boolean verify(JComponent input) { return verifyValueInput(input); } }); valueField.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.value.tip")); this.add(valueField, gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0; JLabel colorLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.color.label")); this.add(colorLabel, gbc); gbc.gridx = 1; gbc.gridy = 1; lineColorButton = new JButton( new ResourceAction(true, "edit_parallel_line.select_line_color") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { createLineColorDialog(); } }); this.add(lineColorButton, gbc); gbc.gridx = 0; gbc.gridy = 2; JLabel widthLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.width.label")); this.add(widthLabel, gbc); gbc.gridx = 1; gbc.gridy = 2; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1; widthField = new JTextField(); widthField.setInputVerifier( new InputVerifier() { @Override public boolean verify(JComponent input) { return verifyWidthInput(input); } }); widthField.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.width.tip")); this.add(widthField, gbc); gbc.gridx = 0; gbc.gridy = 3; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0; JLabel styleLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.line_style.label")); this.add(styleLabel, gbc); gbc.gridx = 1; gbc.gridy = 3; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1; lineStyleCombobox = new JComboBox(LineStyle.values()); ((DefaultComboBoxModel) lineStyleCombobox.getModel()).removeElement(LineStyle.NONE); lineStyleCombobox.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.line_style.tip")); lineStyleCombobox.setSelectedItem(LineStyle.SOLID); this.add(lineStyleCombobox, gbc); gbc.gridx = 0; gbc.gridy = 4; gbc.gridwidth = 2; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1; gbc.weighty = 0; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(15, 5, 5, 5); this.add(new JSeparator(), gbc); gbc.gridx = 0; gbc.gridy = 5; gbc.gridwidth = 1; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); okButton = new JButton(I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.ok.label")); okButton.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.ok.tip")); okButton.setIcon( SwingTools.createIcon( "24/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.ok.icon"))); okButton.setMnemonic( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.ok.mne") .toCharArray()[0]); okButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean successful = editLine(); // don't dispose dialog if not successful if (!successful) { return; } EditParallelLineDialog.this.dispose(); } }); okButton.addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { okButton.doClick(); } } }); this.add(okButton, gbc); gbc.gridx = 1; gbc.gridy = 5; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; cancelButton = new JButton( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.cancel.label")); cancelButton.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.cancel.tip")); cancelButton.setIcon( SwingTools.createIcon( "24/" + I18N.getMessage( I18N.getGUIBundle(), "gui.action.edit_parallel_line.cancel.icon"))); cancelButton.setMnemonic( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.cancel.mne") .toCharArray()[0]); cancelButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // cancel requested, close dialog EditParallelLineDialog.this.dispose(); } }); this.add(cancelButton, gbc); // misc settings this.setMinimumSize(new Dimension(275, 225)); // center dialog this.setLocationRelativeTo(null); this.setTitle( I18N.getMessage(I18N.getGUIBundle(), "gui.action.edit_parallel_line.title.label")); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.setModal(true); this.addWindowListener( new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { cancelButton.requestFocusInWindow(); } }); }
private JXPanel neuLayout() { neuPanel = new JXPanel(); // 1. 2.Min. 3. 4.SS 5. 6.SM 7. 8.ES 9. 10.EM 11. 12. // 13.OK 14. 15.Abb FormLayout lay = new FormLayout( "5dlu,25dlu,10dlu,15dlu,2dlu,15dlu,10dlu,15dlu,2dlu,15dlu,2dlu,6dlu,30dlu,2dlu,30dlu,p:g", "2dlu,p,5dlu,p,2dlu,p"); CellConstraints cc = new CellConstraints(); neuPanel.setLayout(lay); neuPanel.setBackground(Color.WHITE); neuPanel.setOpaque(false); NamePatient = new JRtaTextField("GROSS", false); NamePatient.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED)); NamePatient.setName("NamePatient"); NamePatient.addKeyListener(this); neuPanel.add(NamePatient, cc.xyw(2, 2, 9)); Rezeptnummer = new JRtaTextField("GROSS", false); Rezeptnummer.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED)); Rezeptnummer.setName("Rezeptnummer"); Rezeptnummer.addKeyListener(this); neuPanel.add(Rezeptnummer, cc.xyw(13, 2, 3)); lbl[0] = new JLabel("Minuten"); lbl[0].setForeground(Color.WHITE); lbl[0].setOpaque(false); neuPanel.add(lbl[0], cc.xy(2, 4)); lbl[1] = new JLabel("Startzeit"); lbl[1].setForeground(Color.BLUE); lbl[1].setOpaque(false); neuPanel.add(lbl[1], cc.xyw(4, 4, 4)); lbl[2] = new JLabel("Endzeit"); lbl[2].setForeground(Color.RED); lbl[2].setOpaque(false); neuPanel.add(lbl[2], cc.xyw(8, 4, 4)); Dauer = new JRtaTextField("ZAHLEN", true); Dauer.setHorizontalAlignment(JFormattedTextField.RIGHT); Dauer.setName("Dauer"); Dauer.addFocusListener(this); Dauer.addKeyListener(this); neuPanel.add(Dauer, cc.xy(2, 6)); BeginnStunde = new JRtaTextField("STUNDEN", true); BeginnStunde.setHorizontalAlignment(JFormattedTextField.RIGHT); BeginnStunde.setName("BeginnStunde"); BeginnStunde.addFocusListener(this); BeginnStunde.addKeyListener(this); neuPanel.add(BeginnStunde, cc.xy(4, 6)); BeginnMinute = new JRtaTextField("MINUTEN", true); BeginnMinute.setName("BeginnMinute"); BeginnMinute.addFocusListener(this); BeginnMinute.addKeyListener(this); neuPanel.add(BeginnMinute, cc.xy(6, 6)); EndeStunde = new JRtaTextField("STUNDEN", true); EndeStunde.setHorizontalAlignment(JFormattedTextField.RIGHT); EndeStunde.setName("EndeStunde"); EndeStunde.addFocusListener(this); EndeStunde.addKeyListener(this); neuPanel.add(EndeStunde, cc.xy(8, 6)); EndeMinute = new JRtaTextField("MINUTEN", true); EndeMinute.setName("EndeMinute"); EndeMinute.addFocusListener(this); EndeMinute.addKeyListener(this); neuPanel.add(EndeMinute, cc.xy(10, 6)); Ok = new JButton("Ok"); Ok.setName("Ok"); Ok.setMnemonic(KeyEvent.VK_O); Ok.addKeyListener(this); Ok.addActionListener(this); neuPanel.add(Ok, cc.xy(13, 6)); Abbruch = new JButton("Abbruch"); Abbruch.setName("Abbruch"); Abbruch.setMnemonic(KeyEvent.VK_A); Abbruch.addKeyListener(this); Abbruch.addActionListener(this); neuPanel.add(Abbruch, cc.xy(15, 6)); return neuPanel; }
/** Initializes and displays GUI controls. */ private void initializePanel() { // constants for the height and width of card columns/rows final int columnHeight = HEIGHT_PADDING + (MAX_ROWS * CARD_SPACING) + (MAX_ROWS * CARD_HEIGHT); final int rowWidth = SCROLL_BAR_SPACING + (maxColumns * CARD_SPACING) + (maxColumns * CARD_WIDTH); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.insets = new Insets(10, 10, 10, 0); c.gridheight = 2; c.anchor = GridBagConstraints.NORTH; scrollPane = new JScrollPane(cardImagesPanel); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.getViewport().setPreferredSize(new Dimension(rowWidth, columnHeight)); add(scrollPane, c); c.anchor = GridBagConstraints.CENTER; c.gridheight = 1; c.insets = new Insets(10, 10, 10, 10); c.gridx++; if (doneButton != null) c.gridwidth = 2; add(mainImageLabel, c); c.gridwidth = 1; c.insets.top = 0; c.gridy++; // allows user to use arrow keys on keyboard to traverse/select cards actionButton.addKeyListener( new KeyListener() { public void keyPressed(KeyEvent e) { int newIndex = -1; if (e.getKeyCode() == KeyEvent.VK_UP) newIndex = cardImageLabels.indexOf(selectedImageLabel) - maxColumns; else if (e.getKeyCode() == KeyEvent.VK_DOWN) newIndex = cardImageLabels.indexOf(selectedImageLabel) + maxColumns; else if (e.getKeyCode() == KeyEvent.VK_RIGHT) newIndex = cardImageLabels.indexOf(selectedImageLabel) + 1; else if (e.getKeyCode() == KeyEvent.VK_LEFT) newIndex = cardImageLabels.indexOf(selectedImageLabel) - 1; if (newIndex >= 0 && newIndex < cardImageLabels.size()) setSelectedImageLabel(cardImageLabels.get(newIndex)); } public void keyReleased(KeyEvent e) {} public void keyTyped(KeyEvent e) {} }); add(actionButton, c); if (doneButton != null) { c.gridx++; c.anchor = GridBagConstraints.EAST; // allows user to use arrow keys on keyboard to traverse/select cards doneButton.addKeyListener( new KeyListener() { public void keyPressed(KeyEvent e) { int newIndex = -1; if (e.getKeyCode() == KeyEvent.VK_UP) newIndex = cardImageLabels.indexOf(selectedImageLabel) - maxColumns; else if (e.getKeyCode() == KeyEvent.VK_DOWN) newIndex = cardImageLabels.indexOf(selectedImageLabel) + maxColumns; else if (e.getKeyCode() == KeyEvent.VK_RIGHT) newIndex = cardImageLabels.indexOf(selectedImageLabel) + 1; else if (e.getKeyCode() == KeyEvent.VK_LEFT) newIndex = cardImageLabels.indexOf(selectedImageLabel) - 1; if (newIndex >= 0 && newIndex < cardImageLabels.size()) setSelectedImageLabel(cardImageLabels.get(newIndex)); } public void keyReleased(KeyEvent e) {} public void keyTyped(KeyEvent e) {} }); add(doneButton, c); } }
public createUserYieldDrawInterFace() { // TODO 自动生成构造函数存根 this.setLayout(new GridBagLayout()); this.setBackground(java.awt.Color.PINK); javax.swing.JLabel stuff_id_label = new javax.swing.JLabel("编 号:"); setupComponent(stuff_id_label, 0, 0, 1, 1, true); stuff_id = new javax.swing.JTextField(10); stuff_id.requestFocus(); stuff_id.addKeyListener( new KeyListener() { public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER) && ((stuff_id.getText().trim()) != "")) { stuff_name.requestFocus(); } } public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} }); setupComponent(stuff_id, 1, 0, 1, 1, true); javax.swing.JLabel stuff_name_label = new javax.swing.JLabel("原料名:"); setupComponent(stuff_name_label, 2, 0, 1, 1, true); stuff_name = new javax.swing.JTextField(10); stuff_name.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER) && (stuff_name.getText().trim() != "")) { stuff_company.requestFocus(); } } }); setupComponent(stuff_name, 3, 0, 1, 1, true); javax.swing.JLabel stuff_company_label = new javax.swing.JLabel("生产商:"); setupComponent(stuff_company_label, 4, 0, 1, 1, true); stuff_company = new javax.swing.JTextField(10); stuff_company.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER) && (stuff_company.getText().trim() != "")) { stuff_people.requestFocus(); } } }); setupComponent(stuff_company, 5, 0, 1, 1, true); javax.swing.JLabel stuff_people_label = new javax.swing.JLabel("收货员:"); setupComponent(stuff_people_label, 6, 0, 1, 1, true); stuff_people = new javax.swing.JTextField(10); stuff_people.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER) && (stuff_people.getText().trim() != "")) { check_people.requestFocus(); } } }); setupComponent(stuff_people, 7, 0, 1, 1, true); javax.swing.JLabel check_people_label = new javax.swing.JLabel("检验员:"); setupComponent(check_people_label, 0, 1, 1, 1, true); check_people = new javax.swing.JTextField(10); check_people.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER) && (check_people.getText().trim() != "")) { stuff_unit.requestFocus(); } } }); setupComponent(check_people, 1, 1, 1, 1, true); javax.swing.JLabel stuff_unit_label = new javax.swing.JLabel("单 位:"); setupComponent(stuff_unit_label, 2, 1, 1, 1, true); stuff_unit = new javax.swing.JTextField(10); stuff_unit.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER) && (stuff_unit.getText().trim() != "")) { stuff_value.requestFocus(); } } }); setupComponent(stuff_unit, 3, 1, 1, 1, true); javax.swing.JLabel stuff_value_label = new javax.swing.JLabel("数 量:"); setupComponent(stuff_value_label, 4, 1, 1, 1, true); stuff_value = new javax.swing.JTextField(10); stuff_value.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER) && (stuff_value.getText().trim() != "")) { if (CheckValue(stuff_value.getText().trim())) { stuff_spec.requestFocus(); } else { javax.swing.JOptionPane.showMessageDialog( null, "你的录入有误,请录入0-9的数值!", "录入错误", javax.swing.JOptionPane.ERROR_MESSAGE); stuff_value.setText(""); stuff_value.requestFocus(); } } } }); setupComponent(stuff_value, 5, 1, 1, 1, true); javax.swing.JLabel stuff_spec_label = new javax.swing.JLabel("规 格:"); setupComponent(stuff_spec_label, 6, 1, 1, 1, true); stuff_spec = new javax.swing.JTextField(10); stuff_spec.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER) && (stuff_spec.getText().trim() != "")) { stuff_color.requestFocus(); } } }); setupComponent(stuff_spec, 7, 1, 1, 1, true); javax.swing.JLabel stuff_color_label = new javax.swing.JLabel("颜 色:"); setupComponent(stuff_color_label, 0, 2, 1, 1, true); stuff_color = new javax.swing.JTextField(10); stuff_color.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER) && (stuff_color.getText().trim() != "")) { stuff_place.requestFocus(); } } }); setupComponent(stuff_color, 1, 2, 1, 1, true); javax.swing.JLabel stuff_place_label = new javax.swing.JLabel("存放位置:"); setupComponent(stuff_place_label, 2, 2, 1, 1, true); stuff_place = new javax.swing.JTextField(10); stuff_place.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER) && (stuff_place.getText().trim() != "")) { stock_date.requestFocus(); } } }); setupComponent(stuff_place, 3, 2, 1, 1, true); javax.swing.JLabel stock_date_label = new javax.swing.JLabel("入库时间:"); setupComponent(stock_date_label, 4, 2, 1, 1, true); stock_date = new javax.swing.JTextField(10); stock_date.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER) && (stock_date.getText().trim() != "")) { if (CheckDate(stock_date.getText().trim())) { stuff_text.requestFocus(); } else { javax.swing.JOptionPane.showMessageDialog( null, "数据录入错误格式为:YYYY/MM/DD,请你重新输入!", "数据错误", javax.swing.JOptionPane.ERROR_MESSAGE); stock_date.setText(""); stock_date.requestFocus(); } } } }); setupComponent(stock_date, 5, 2, 1, 1, true); javax.swing.JLabel stuff_text_label = new javax.swing.JLabel("原料备注:"); setupComponent(stuff_text_label, 6, 2, 1, 1, true); stuff_text = new javax.swing.JTextField(10); stuff_text.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER)) { enter.requestFocus(); } } }); setupComponent(stuff_text, 7, 2, 1, 1, true); enter = new javax.swing.JButton("录 入"); enter.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { if ((e.getKeyChar() == KeyEvent.VK_ENTER)) { IsGood(); } } }); enter.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { IsGood(); } }); setupComponent(enter, 1, 3, 1, 1, true); clean = new javax.swing.JButton("清 空"); clean.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { clean(); } }); setupComponent(clean, 3, 3, 1, 1, true); cancle = new javax.swing.JButton("退 出"); cancle.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) {} }); setupComponent(cancle, 5, 3, 1, 1, true); }
@SuppressWarnings({"unchecked", "rawtypes"}) private void initializeComponent() { // Initialize panels panel_1 = new JPanel(); panel_2 = new JPanel(); panel_3 = new JPanel(); panel_4 = new JPanel(); panel_5 = new JPanel(); panel_6 = new JPanel(); panel_7 = new JPanel(); // Initialize spinner spinnermodel = new SpinnerNumberModel(0, 0, 10, 1); spinner = new JSpinner(spinnermodel); // Initialize combo box searchcombobox = new JComboBox(); searchcombobox.addItem("All"); searchcombobox.addItem("By Name"); searchcombobox.addItem("By Guardian Name"); searchcombobox.addItem("By Course"); searchcombobox.addItem("Due Fees"); searchcombobox.setSelectedIndex(0); coursecombobox = new JComboBox(); coursecombobox.addItem("Select Course"); Database db = new Database(); String courses[] = db.getCourses(); if (courses != null) { for (String x : courses) { coursecombobox.addItem(x); } } // Initialize text field searchtextfield = new JTextField(10); addfeestextfield = new JTextField(8); // Initialize button searchbutton = new JButton("Search"); addfeesbutton = new JButton("Add fees"); addcoursebutton = new JButton("Add Course"); // Initialize check box allfieldcheckbox = new JCheckBox("Show all fields"); allfieldcheckbox.setSelected(true); // Initialize label totalstudentlabel = new JLabel("Total Student"); feespayedlabel = new JLabel("Fees Payed"); feesduelabel = new JLabel("Fees due"); totalfeeslabel = new JLabel("Total fees"); // Add Item listener to check box allfieldcheckbox.addItemListener(this); // Add Action Listener to button searchbutton.addActionListener(this); addfeesbutton.addActionListener(this); addcoursebutton.addActionListener(this); // Add Key Listener to button searchbutton.addKeyListener(this); addfeesbutton.addKeyListener(this); addcoursebutton.addKeyListener(this); }
public UiAboutDlg(JFrame owner, UiLocalization localization) throws HeadlessException { super(owner, "", true); getContentPane().setLayout(new BorderLayout()); // System.out.println("Number of calls to verifyPacketSignature " + // Packet.callsToVerifyPacketSignature); // System.out.println("Cumulative time in verifyPacketSignature " + // Packet.millisInVerifyPacketSignature); // System.out.println("Number of calls to XmlPacketLoader " + // XmlPacketLoader.callsToXmlPacketLoader); // System.out.println("Cumulative time in XmlPacketLoader " + // XmlPacketLoader.millisInXmlPacketLoader); setTitle(localization.getWindowTitle("about")); JLabel icon = new JLabel( new ImageIcon(UiAboutDlg.class.getResource("Martus-logo-black-text-160x72.png")), JLabel.LEFT); StringBuffer versionInfo = new StringBuffer(UiConstants.programName); versionInfo.append(" "); versionInfo.append(localization.getFieldLabel("aboutDlgVersionInfo")); versionInfo.append(" "); versionInfo.append(UiConstants.versionLabel); StringBuffer mlpDateInfo = new StringBuffer(); if (localization.isTranslationInsideMLP()) { mlpDateInfo.append(localization.getFieldLabel("aboutDlgMlpDateInfo")); mlpDateInfo.append(" "); MultiCalendar mlpDate = new MultiCalendar(); mlpDate.setTime(localization.getMlpDate()); String storedDateString = MartusFlexidate.toStoredDateFormat(mlpDate); mlpDateInfo.append(localization.convertStoredDateToDisplay(storedDateString)); } StringBuffer mtfVersionInfo = new StringBuffer(localization.getFieldLabel("aboutDlgTranslationVersionInfo")); mtfVersionInfo.append(" "); mtfVersionInfo.append(localization.getTranslationFullVersionInfo()); if (!localization.isCurrentTranslationOfficial()) mtfVersionInfo.append("X"); StringBuffer buildDate = new StringBuffer(localization.getFieldLabel("aboutDlgBuildDate")); buildDate.append(" "); buildDate.append(VersionBuildDate.getVersionBuildDate()); JButton ok = new UiButton(localization.getButtonLabel(EnglishCommonStrings.OK)); ok.addActionListener(this); ok.addKeyListener(new MakeEnterKeyExit()); Box vBoxVersionInfo = new UiVBox(); vBoxVersionInfo.add(new UiLabel(versionInfo.toString())); if (mlpDateInfo.length() > 0) vBoxVersionInfo.add(new UiLabel(mlpDateInfo.toString())); vBoxVersionInfo.add(new UiLabel(mtfVersionInfo.toString())); vBoxVersionInfo.add(new UiLabel(UiConstants.copyright)); vBoxVersionInfo.add(new UiLabel(UiConstants.website)); vBoxVersionInfo.add(new UiLabel(buildDate.toString())); Box hBoxVersionAndIcon = Box.createHorizontalBox(); hBoxVersionAndIcon.add(Box.createHorizontalGlue()); hBoxVersionAndIcon.add(vBoxVersionInfo); hBoxVersionAndIcon.add(Box.createHorizontalGlue()); hBoxVersionAndIcon.add(icon); Box hBoxOk = Box.createHorizontalBox(); hBoxOk.add(Box.createHorizontalGlue()); hBoxOk.add(ok); hBoxOk.add(Box.createHorizontalGlue()); final String disclaimer = localization.getFieldLabel("aboutDlgDisclaimer"); final String credits = localization.getFieldLabel("aboutDlgCredits"); final String notice = "\n" + disclaimer + "\n\n" + credits + "\n\n" + localization.getFieldLabel("aboutDlgThirdParty"); getContentPane().add(hBoxVersionAndIcon, BorderLayout.NORTH); getContentPane().add(new UiWrappedTextArea(notice), BorderLayout.CENTER); getContentPane().add(hBoxOk, BorderLayout.SOUTH); Utilities.packAndCenterWindow(this); setVisible(true); }
// 构造函数 public PracticeFrame(final int x) { super(); this.x = x; this.setVisible(true); this.setBounds(200, 200, 400, 300); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent arg0) { btnPractice.setEnabled(true); btnSpellWord.setEnabled(true); } }); delete.addActionListener(new DeleteAction()); delete.addKeyListener(new keyEventHandler()); next.addKeyListener(new keyEventHandler()); next.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (x == 1) { NewPractice(); } else if (x == 2) { NextSpellQuestion(); } } }); ButtonPane.add(delete); ButtonPane.add(next); SubjectPane.add(Subject, BorderLayout.CENTER); SubjectPane.add(new JLabel(), BorderLayout.EAST); // 初始化4个答案 for (int i = 0; i < 4; i++) { Answer[i] = new JRadioButton("" + i); buttongroup.add(Answer[i]); AnswerPane.add(Answer[i]); Answer[i].addActionListener(actionHandler); Answer[i].addKeyListener(new keyEventHandler()); } Answer[0].setMnemonic(KeyEvent.VK_1); Answer[1].setMnemonic(KeyEvent.VK_2); Answer[2].setMnemonic(KeyEvent.VK_3); Answer[3].setMnemonic(KeyEvent.VK_4); // card的布局 // 对p1的操作 pane.setLayout(card); p1.setLayout(new BorderLayout()); p1.add(SubjectPane, BorderLayout.NORTH); p1.add(AnswerPane, BorderLayout.CENTER); pane.add(p1, "p1"); // 对p2的操作 p2.setLayout(new BorderLayout()); RightAnswer.setFont(new Font("宋体", Font.BOLD, 20)); RightAnswer.setLineWrap(true); RightAnswer.setEditable(false); p2.add(RightAnswerpane, BorderLayout.CENTER); JPanel buJPanel = new JPanel(new GridLayout(0, 5)); pane.add(p2, "p2"); this.getContentPane().add(ButtonPane, BorderLayout.NORTH); this.getContentPane().add(pane, BorderLayout.CENTER); this.addKeyListener(new keyEventHandler()); // 对p3的操作 p3.setLayout(new BorderLayout()); JPanel panel = new JPanel(new GridLayout(0, 4, 10, 10)); Spell.setFont(new Font("宋体", Font.BOLD, 20)); Questionmean.setFont(new Font("宋体", Font.BOLD, 18)); Questionmean.setEditable(false); Questionmean.setLineWrap(true); panel.add(Spell); panel.add(WordTextFile); panel.add(Sure); panel.add(Speak); p3.add(Questionmean, BorderLayout.CENTER); p3.add(panel, BorderLayout.SOUTH); pane.add(p3, "p3"); Sure.addActionListener(actionHandler); WordTextFile.addKeyListener(new keyEventHandler()); Speak.addActionListener(actionHandler); Speak.addKeyListener(new keyEventHandler()); // 初始化标记数组 for (int i = 0; i < mark.length; i++) { mark[i] = false; } if (x == 1) { NewPractice(); } else if (x == 2) { NextSpellQuestion(); NewSpeakWord(); } }
// ds component setup private void _setComponents() { // ds scroll speed of panel m_cPanelCImage.getVerticalScrollBar().setUnitIncrement(25); // ds register the buttons m_cButtonReset.addActionListener(this); m_cButtonReset.addKeyListener(this); m_cButtonDislike.addActionListener(this); m_cButtonDislike.addKeyListener(this); m_cButtonLike.addActionListener(this); m_cButtonLike.addKeyListener(this); m_cButtonPrevious.addActionListener(this); m_cButtonPrevious.addKeyListener(this); // ds customize mechanical buttons m_cButtonReset.setPreferredSize(new Dimension(120, 25)); m_cButtonPrevious.setPreferredSize(new Dimension(110, 30)); // ds customize like buttons m_cButtonDislike.setBackground(Color.red); m_cButtonLike.setBackground(Color.green); m_cButtonDislike.setPreferredSize(new Dimension(110, 30)); m_cButtonLike.setPreferredSize(new Dimension(110, 30)); // ds button icons final ImageIcon cIconLike = new ImageIcon("icons/like_resized.png"); final ImageIcon cIconDislike = new ImageIcon("icons/dislike_resized.png"); final ImageIcon cIconPrevious = new ImageIcon("icons/back_resized.png"); // ds customize m_cButtonLike.setIcon(cIconLike); m_cButtonDislike.setIcon(cIconDislike); m_cButtonPrevious.setIcon(cIconPrevious); m_cButtonLike.setMargin(new Insets(0, 0, 0, 0)); m_cButtonDislike.setMargin(new Insets(0, 0, 0, 0)); m_cButtonPrevious.setMargin(new Insets(0, 0, 0, 0)); m_cButtonLike.setForeground(Color.darkGray); m_cButtonDislike.setForeground(Color.white); m_cButtonPrevious.setForeground(Color.darkGray); // ds textfields m_cTextFieldTitle.setEditable(false); m_cTextFieldTitle.setFont(m_cFontTitle); m_cTextFieldURL.setEditable(false); m_cTextFieldTags.setEditable(false); m_cTextFieldImageID.setEditable(false); m_cTextFieldLikes.setEditable(false); m_cTextFieldDislikes.setEditable(false); m_cTextFieldVisits.setEditable(false); m_cTextFieldConfidence.setEditable(false); m_cTextFieldType.setEditable(false); m_cTextFieldDatasetSize.setEditable(false); m_cTextFieldTextPercent.setEditable(false); m_cTextFieldIsPhoto.setEditable(false); m_cTextFieldComments.setEditable(false); m_cTextFieldTagsCount.setEditable(false); m_cTextFieldTotalLikes.setEditable(false); // ds add the sidebar panels final JPanel cPanelImageID = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelLikes = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelDislikes = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelVisits = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelConfidence = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelType = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelDatasetSize = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelTextPercent = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelIsPhoto = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelComments = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelTagsCount = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelTotalLikes = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // ds structural side bar final JPanel cPanelProperties = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelLearning = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JPanel cPanelWhitespace = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // ds add labels and textfield to each panel cPanelImageID.add(new JLabel("MySQL ID: ")); cPanelImageID.add(m_cTextFieldImageID); cPanelLikes.add(new JLabel("Likes: ")); cPanelLikes.add(m_cTextFieldLikes); cPanelDislikes.add(new JLabel("Dislikes: ")); cPanelDislikes.add(m_cTextFieldDislikes); cPanelVisits.add(new JLabel("Visited Images: ")); cPanelVisits.add(m_cTextFieldVisits); cPanelConfidence.add(new JLabel("Confidence: ")); cPanelConfidence.add(m_cTextFieldConfidence); cPanelType.add(new JLabel("Type: ")); cPanelType.add(m_cTextFieldType); cPanelDatasetSize.add(new JLabel("Operations: ")); cPanelDatasetSize.add(m_cTextFieldDatasetSize); cPanelTextPercent.add(new JLabel("Text Amount: ")); cPanelTextPercent.add(m_cTextFieldTextPercent); cPanelIsPhoto.add(new JLabel("Photograph: ")); cPanelIsPhoto.add(m_cTextFieldIsPhoto); cPanelComments.add(new JLabel("Comments: ")); cPanelComments.add(m_cTextFieldComments); cPanelTagsCount.add(new JLabel("Tags Count: ")); cPanelTagsCount.add(m_cTextFieldTagsCount); cPanelTotalLikes.add(new JLabel("Total Likes: ")); cPanelTotalLikes.add(m_cTextFieldTotalLikes); cPanelProperties.add(new JLabel("Properties ")); cPanelLearning.add(new JLabel("Learning ")); cPanelWhitespace.add(new JLabel("")); // ds set maximum size to align vertically cPanelImageID.setMaximumSize(cPanelImageID.getPreferredSize()); cPanelLikes.setMaximumSize(cPanelLikes.getPreferredSize()); cPanelDislikes.setMaximumSize(cPanelDislikes.getPreferredSize()); cPanelVisits.setMaximumSize(cPanelVisits.getPreferredSize()); cPanelConfidence.setMaximumSize(cPanelConfidence.getPreferredSize()); cPanelType.setMaximumSize(cPanelType.getPreferredSize()); cPanelDatasetSize.setMaximumSize(cPanelDatasetSize.getPreferredSize()); cPanelTextPercent.setMaximumSize(cPanelTextPercent.getPreferredSize()); cPanelIsPhoto.setMaximumSize(cPanelIsPhoto.getPreferredSize()); cPanelComments.setMaximumSize(cPanelComments.getPreferredSize()); cPanelTagsCount.setMaximumSize(cPanelTagsCount.getPreferredSize()); cPanelTotalLikes.setMaximumSize(cPanelTotalLikes.getPreferredSize()); cPanelProperties.setMaximumSize(cPanelProperties.getPreferredSize()); cPanelLearning.setMaximumSize(cPanelLearning.getPreferredSize()); cPanelWhitespace.setMaximumSize(cPanelWhitespace.getPreferredSize()); // ds align right horizontally cPanelImageID.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelLikes.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelDislikes.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelVisits.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelConfidence.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelType.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelDatasetSize.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelTextPercent.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelIsPhoto.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelComments.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelTagsCount.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelTotalLikes.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelProperties.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelLearning.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelWhitespace.setAlignmentX(Component.RIGHT_ALIGNMENT); cPanelProperties.setBorder(BorderFactory.createLineBorder(Color.blue)); cPanelLearning.setBorder(BorderFactory.createLineBorder(Color.blue)); // ds north panels final JPanel cPanelTitle = new JPanel(new FlowLayout(FlowLayout.LEFT)); final JPanel cPanelURL = new JPanel(new FlowLayout(FlowLayout.LEFT)); final JPanel cPanelTags = new JPanel(new FlowLayout(FlowLayout.LEFT)); // final JPanel cPanelFlowWhitespace = new JPanel( new FlowLayout( FlowLayout.LEFT ) ); // ds connect /*cPanelTitle.add( new JLabel( " Title: " ) );*/ cPanelTitle.add(m_cTextFieldTitle); cPanelURL.add(new JLabel(" URL: ")); cPanelURL.add(m_cTextFieldURL); cPanelTags.add(new JLabel("Tags: ")); cPanelTags.add(m_cTextFieldTags); // ds setup the main panels m_cPanelNorth.setLayout(new BoxLayout(m_cPanelNorth, BoxLayout.Y_AXIS)); m_cPanelNorth.setAlignmentX(Component.LEFT_ALIGNMENT); // m_cPanelNorth.add( cPanelURL ); // m_cPanelNorth.add( cPanelTags ); // m_cPanelNorth.add( cPanelFlowWhitespace ); m_cPanelNorth.add(cPanelTitle); // ds side panel m_cPanelEast.setLayout(new BoxLayout(m_cPanelEast, BoxLayout.Y_AXIS)); m_cPanelEast.add(cPanelProperties); m_cPanelEast.add(cPanelImageID); m_cPanelEast.add(cPanelType); m_cPanelEast.add(cPanelTextPercent); m_cPanelEast.add(cPanelIsPhoto); m_cPanelEast.add(cPanelLikes); m_cPanelEast.add(cPanelDislikes); m_cPanelEast.add(cPanelComments); m_cPanelEast.add(cPanelTagsCount); m_cPanelEast.add(cPanelWhitespace); m_cPanelEast.add(cPanelLearning); m_cPanelEast.add(cPanelDatasetSize); m_cPanelEast.add(cPanelVisits); m_cPanelEast.add(cPanelTotalLikes); m_cPanelEast.add(cPanelConfidence); // m_cPanelSouth.add( m_cButtonReset ); m_cPanelSouth.add(m_cButtonPrevious); m_cPanelSouth.add(m_cButtonDislike); m_cPanelSouth.add(m_cButtonLike); }