protected JPanel makeMessage() { JPanel p = new JPanel(new BorderLayout()); myMessage = new JTextField(30); p.setBorder(BorderFactory.createTitledBorder("message")); p.add(myMessage, BorderLayout.CENTER); return p; }
/* *Creates the JTextField for the GUI. */ private JTextField inputField() { inputField = new JTextField(); Border inputBorder = BorderFactory.createEtchedBorder(); inputBorder = BorderFactory.createTitledBorder(inputBorder, "Please type your words here:"); inputField.setBorder(inputBorder); inputField.addActionListener(new ActionListenerField()); return inputField; }
public void buildPopulationBox() { rebuilding = true; populationBox.removeAll(); peopleList = new ArrayList<Object>(); famList = new ArrayList<Family>(); peopleList.addAll(ctxt.individualCensus); String plur = (peopleList.size() == 1 ? "" : "s"); populationBox.setLayout(new BoxLayout(populationBox, BoxLayout.PAGE_AXIS)); populationBox.setBorder( BorderFactory.createTitledBorder( BorderFactory.createLineBorder(Color.blue), "Current Population")); populationBox.setAlignmentX(0.5f); populationBox.add(Box.createRigidArea(new Dimension(8, 0))); indivLabel = new JLabel("Contains " + peopleList.size() + " Individual" + plur); indivLabel.setAlignmentX(0.5f); populationBox.add(indivLabel); if (peopleList.size() > 0) { JPanel indivBtnBox = new JPanel(); indivBtnBox.setLayout(new BoxLayout(indivBtnBox, BoxLayout.LINE_AXIS)); Dimension sizer2 = new Dimension(350, 50); String[] indMenu = genIndMenu(peopleList); indPick = new JComboBox(indMenu); indPick.addActionListener(listener); indPick.setActionCommand("view/edit person"); indPick.setMinimumSize(sizer2); indPick.setMaximumSize(sizer2); indPick.setBorder( BorderFactory.createTitledBorder( BorderFactory.createLineBorder(Color.blue), "View/Edit Person")); indivBtnBox.add(indPick); populationBox.add(indivBtnBox); } // end of if-any-people-exist famList.addAll(ctxt.familyCensus); // end of filtering deleted records plur = (famList.size() == 1 ? "y" : "ies"); famLabel = new JLabel("Contains " + famList.size() + " Famil" + plur); famLabel.setAlignmentX(0.5f); populationBox.add(Box.createRigidArea(new Dimension(0, 4))); populationBox.add(famLabel); if (famList.size() > 0) { JPanel famBtnBox = new JPanel(); famBtnBox.setLayout(new BoxLayout(famBtnBox, BoxLayout.LINE_AXIS)); Dimension sizer2 = new Dimension(350, 50); String[] famMenu = genFamMenu(famList); famPick = new JComboBox(famMenu); famPick.addActionListener(listener); famPick.setActionCommand("view/edit family"); famPick.setMinimumSize(sizer2); famPick.setMaximumSize(sizer2); famPick.setBorder( BorderFactory.createTitledBorder( BorderFactory.createLineBorder(Color.blue), "View/Edit Family")); famBtnBox.add(famPick); populationBox.add(famBtnBox); } // end of if-any-families-exist rebuilding = false; } // end of method buildPopulationBox
private OffsetPanel(Component comp) { this.setLayout(new BorderLayout(0, 0)); TitledBorder tb = BorderFactory.createTitledBorder(b.getString("kOffsetBy")); if (JOAConstants.ISMAC) { // tb.setTitleFont(new Font("Helvetica", Font.PLAIN, 11)); } this.setBorder(tb); JPanel controls = new JPanel(); controls.setLayout(new GridLayout(3, 1, 5, 0)); b1 = new JOAJRadioButton(b.getString("kSequence")); b2 = new JOAJRadioButton(b.getString("kDistance"), true); b3 = new JOAJRadioButton(b.getString("kTime")); controls.add(b2); controls.add(b1); controls.add(b3); controls.add(new JOAJLabel(" ")); ButtonGroup bg = new ButtonGroup(); bg.add(b1); bg.add(b2); bg.add(b3); this.add("Center", controls); b1.addItemListener((ItemListener) comp); b2.addItemListener((ItemListener) comp); b3.addItemListener((ItemListener) comp); }
public DisplayResults() { GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); setLayout(gbl); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; text.setForeground(Color.black); add(text, gbc); gbc.gridy = 0; gbc.gridwidth = GridBagConstraints.REMAINDER; add(emptyLabel, gbc); add(Box.createVerticalStrut(0), gbc); add(emptyLabel, gbc); /* gbc.gridy = 1; VTextMsg result = new VTextMsg(sshare, vnmrif, null); result.setPreferredSize(new Dimension(300, 30)); result.setForeground(Color.black); add( result, gbc ); */ setBorder( new CompoundBorder( BorderFactory.createTitledBorder(" Results "), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
protected JPanel makeOutput() { JPanel p = new JPanel(new BorderLayout()); myOutput = new JTextArea(10, 40); p.setBorder(BorderFactory.createTitledBorder("output")); p.add(new JScrollPane(myOutput), BorderLayout.CENTER); return p; }
public CreInvChecker(Component parent) { typeButtons = new JCheckBox[CHECKTYPES.length]; JPanel boxPanel = new JPanel(new GridLayout(0, 1)); for (int i = 0; i < typeButtons.length; i++) { typeButtons[i] = new JCheckBox(CHECKTYPES[i], true); boxPanel.add(typeButtons[i]); } bstart.setMnemonic('s'); bcancel.setMnemonic('c'); bstart.addActionListener(this); bcancel.addActionListener(this); selectframe.getRootPane().setDefaultButton(bstart); selectframe.setIconImage(Icons.getIcon("Find16.gif").getImage()); boxPanel.setBorder(BorderFactory.createTitledBorder("Select test to check:")); JPanel bpanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); bpanel.add(bstart); bpanel.add(bcancel); JPanel mainpanel = new JPanel(new BorderLayout()); mainpanel.add(boxPanel, BorderLayout.CENTER); mainpanel.add(bpanel, BorderLayout.SOUTH); mainpanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); JPanel pane = (JPanel) selectframe.getContentPane(); pane.setLayout(new BorderLayout()); pane.add(mainpanel, BorderLayout.CENTER); selectframe.pack(); Center.center(selectframe, parent.getBounds()); selectframe.setVisible(true); }
public static void updateResultsTable(Object[][] data) { // remove old route table resultsPanel.removeAll(); // create new route table String[] columnNames = { "Route #", "Carrier", "Dep. Airport", "Dep. Time", "Arr. Airport", "Arr. Time", "Price" }; JScrollPane routeTable = new JScrollPane( new JTable(data, columnNames) { public boolean isCellEditable(int rowIndex, int vColIndex) { return false; }; }); // create the routes table in a scrollPane routeTable.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); routeTable.setPreferredSize(new Dimension(resultsPanelWidth, resultsPanelHeight)); resultsPanel.add(routeTable); // add the table to the JPanel resultsPanel.setBorder(BorderFactory.createTitledBorder("Search Results")); // display new route table resultsPanel.revalidate(); resultsPanel.repaint(); }
public DisplayUserDirectory() { GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); setLayout(gbl); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; hmlabel.setForeground(Color.black); add(hmlabel, gbc); add(Box.createHorizontalStrut(10), gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; add(hmdir, gbc); add(Box.createVerticalStrut(15), gbc); gbc.gridwidth = 1; vjlabel.setForeground(Color.black); add(vjlabel, gbc); add(Box.createHorizontalStrut(10), gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; add(vjdir, gbc); add(Box.createVerticalStrut(0), gbc); gbc.gridwidth = 1; vjlabel2.setForeground(Color.black); add(vjlabel2, gbc); setBorder( new CompoundBorder( // i18n // BorderFactory.createTitledBorder(" User_Directories "), BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
/** * And now for a little assembly. Put together the buttons, progress bar and status text field. */ Example1(String name) { setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), name)); progressBar.setMaximum(NUMLOOPS); startButton = new JButton("Start"); startButton.addActionListener(startListener); startButton.setEnabled(true); interruptButton = new JButton("Cancel"); interruptButton.addActionListener(interruptListener); interruptButton.setEnabled(false); JComponent buttonBox = new JPanel(); buttonBox.add(startButton); buttonBox.add(interruptButton); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(buttonBox); add(progressBar); add(statusField); statusField.setAlignmentX(CENTER_ALIGNMENT); buttonBox.setBorder(spaceBelow); Border pbBorder = progressBar.getBorder(); progressBar.setBorder(BorderFactory.createCompoundBorder(spaceBelow, pbBorder)); }
/** 查询 */ private void search() { // 调用查询窗口 Function function = new Function(); Search search = new Search(this, staffInfo); function.setFunctionDialog(search); function.create(); if (search.isUpdate()) { int searched = search.getSearched(); switch (searched) { case 0: DMManage(); break; case 1: break; case 3: break; case 4: break; case 5: break; } content = search.getResultContent(); header = search.getResultHeader(); displayPanel.setBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "查询结果")); setTable(content, header); } }
public FloorPanel(int floorNumber, String title, int directions) { super(); setBackground(Color.GRAY); setLayout(new GridLayout(1, 2)); Border border = BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK), title); setBorder(border); if (directions == Constants.DIRECTION_UP || directions == Constants.DIRECTION_BOTH) { // up button up = new JButton(UIUtils.UP_ARROW); add(up); up.addActionListener(this); } if (directions == Constants.DIRECTION_DOWN || directions == Constants.DIRECTION_BOTH) { // down button down = new JButton(UIUtils.DOWN_ARROW); add(down); down.addActionListener(this); } this.floorNumber = floorNumber; }
public AddNewStudent() // constructor { // initializing buttons btnok = new JButton("OK"); btnok.addActionListener(this); btnexit = new JButton("Exit"); btnexit.addActionListener(this); btnaddnew = new JButton("AddNew"); btnaddnew.addActionListener(this); // initializing textfields tf1 = new JTextField(12); tf2 = new JTextField(12); // initializing labels lblname = new JLabel("Name:"); lbladd = new JLabel("Address:"); lblmsg = new JLabel("", JLabel.CENTER); // initializing panels p1 = new JPanel(); p2 = new JPanel(); p3 = new JPanel(); psouth = new JPanel(); // adding buttons and label to panel p1 // setting flowlayout p1.setLayout(new FlowLayout()); p1.add(btnok); p1.add(btnexit); p1.add(btnaddnew); // adding lblmsg to panel p3 p3.add(lblmsg); // adding both the panels to new panel,psouth // settin layout 2:1 psouth.setLayout(new GridLayout(2, 1)); psouth.add(p3); psouth.add(p1); // adding label and textfields to panel p2 p2.setLayout(new GridLayout(3, 1)); // setting line and titled border for panel p2 p2.setBorder(BorderFactory.createLineBorder(Color.red)); p2.setBorder(BorderFactory.createTitledBorder("Enter Your Details")); p2.add(lblname); p2.add(tf1); p2.add(lbladd); p2.add(tf2); // adding panel to container this.getContentPane().add(p2, "Center"); this.getContentPane().add(psouth, "South"); this.setSize(300, 300); this.setLocation(100, 200); this.show(); }
protected JPanel createForm() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); // Time JPanel pT = new JPanel(new FlowLayout()); pT.setBorder(BorderFactory.createTitledBorder("Start Time")); hh = new JSpinner(new SpinnerNumberModel(Util.getHours(myrow.getTime()), 0, 99, 1)); hh.setEditor(new JSpinner.NumberEditor(hh, "00")); pT.add(hh); pT.add(new JLabel("h ")); mm = new JSpinner(new SpinnerNumberModel(Util.getMinutes(myrow.getTime()), 0, 59, 1)); mm.setEditor(new JSpinner.NumberEditor(mm, "00")); pT.add(mm); pT.add(new JLabel("m ")); ss = new JSpinner(new SpinnerNumberModel(Util.getSeconds(myrow.getTime()), 0, 59, 1)); ss.setEditor(new JSpinner.NumberEditor(ss, "00")); pT.add(ss); pT.add(new JLabel("s")); panel.add(pT); // Green JPanel pG = new JPanel(new BorderLayout()); pG.setBorder(BorderFactory.createTitledBorder("Green (sec.)")); green = new JSpinner(new SpinnerNumberModel(myrow.getGreen() * conversion, 0.0, 99999.99, 1)); green.setEditor(new JSpinner.NumberEditor(green, "####0.##")); pG.add(green); panel.add(pG); // Red JPanel pR = new JPanel(new BorderLayout()); pR.setBorder(BorderFactory.createTitledBorder("Red (sec.)")); red = new JSpinner(new SpinnerNumberModel(myrow.getRed() * conversion, 0.0, 99999.99, 1)); red.setEditor(new JSpinner.NumberEditor(red, "####0.##")); pR.add(red); panel.add(pR); JPanel bp = new JPanel(new FlowLayout()); JButton bOK = new JButton(" OK "); bOK.setActionCommand(cmdOK); bOK.addActionListener(new ButtonEventsListener()); JButton bCancel = new JButton("Cancel"); bCancel.setActionCommand(cmdCancel); bCancel.addActionListener(new ButtonEventsListener()); bp.add(bOK); bp.add(bCancel); panel.add(bp); return panel; }
public RowPanel(String name) { super(); Border empty = BorderFactory.createEmptyBorder(10, 10, 10, 10); Border line = BorderFactory.createLineBorder(Color.GRAY); Border title = BorderFactory.createTitledBorder(line, name); Border compound = BorderFactory.createCompoundBorder(title, empty); setBorder(compound); setLayout(new RowLayout()); }
public void setBorder(JPanel panel, String theme) { panel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), theme, javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.DEFAULT_POSITION, new Font("Tahoma", Font.PLAIN, 11), Color.blue.darker().darker())); }
/** init() sets up the applet interface which consists of the Draw and Clear buttons. */ public void init() { getContentPane().setLayout(new BorderLayout()); draw.addActionListener(this); clear.addActionListener(this); controls.add(draw); controls.add(clear); canvas.setBorder(BorderFactory.createTitledBorder("Drawing Canvas")); getContentPane().add("North", controls); getContentPane().add("Center", canvas); getContentPane().setSize(400, 400); } // init()
private JPanel getSelectedRobotsPanel() { if (selectedRobotsPanel == null) { selectedRobotsPanel = new JPanel(); selectedRobotsPanel.setLayout(new BorderLayout()); selectedRobotsPanel.setPreferredSize(new Dimension(120, 100)); selectedRobotsPanel.setBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Selected Robots")); selectedRobotsPanel.add(getSelectedRobotsScrollPane(), BorderLayout.CENTER); } return selectedRobotsPanel; }
public static void main(String args[]) { JFrame f = new JFrame("JPasswordField3"); Container contentPane = f.getContentPane(); contentPane.setLayout(new BorderLayout()); JPanel p1 = new JPanel(); // p1.setLayout(new GridLayout(4,2)); p1.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; // 设定Layout的位置 gbc.insets = new Insets(2, 2, 2, 2); // 设定与边界的距离(上,左,下,右) p1.setBorder(BorderFactory.createTitledBorder("您的基本数据")); JLabel l1 = new JLabel("姓名:"); JLabel l2 = new JLabel("性别:"); JLabel l3 = new JLabel("身高:"); JLabel l4 = new JLabel("体重:"); JPasswordField t1 = new JPasswordField(new JPasswordField3_OnlyNumberDocument(10), "", 10); JPasswordField t2 = new JPasswordField(new JPasswordField3_OnlyNumberDocument(1), "", 2); JPasswordField t3 = new JPasswordField(new JPasswordField3_OnlyNumberDocument(5), "", 5); JPasswordField t4 = new JPasswordField(new JPasswordField3_OnlyNumberDocument(5), "", 5); gbc.gridy = 1; gbc.gridx = 0; p1.add(l1, gbc); gbc.gridx = 1; p1.add(t1, gbc); gbc.gridy = 2; gbc.gridx = 0; p1.add(l2, gbc); gbc.gridx = 1; p1.add(t2, gbc); gbc.gridy = 3; gbc.gridx = 0; p1.add(l3, gbc); gbc.gridx = 1; p1.add(t3, gbc); gbc.gridy = 4; gbc.gridx = 0; p1.add(l4, gbc); gbc.gridx = 1; p1.add(t4, gbc); contentPane.add(p1); f.pack(); f.show(); f.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); }
/** * Create a Proj2DClickPanel instance * * @param title the name for the sub-window * @param plotViewer the plot panel for 2D projection as well as center selection * @param numPoints the required number of click pointers */ public Proj2DClickPanel(String title, Plot2DViewer plotViewer, int numPoints) { totalNum = numPoints; // cluster2DCenters = new double[numPoints][2]; this.plotViewer = plotViewer; plotViewer.plotPanel.plotCanvas.addMouseListener(this); // change the ActionMode to be center selection plotViewer.plotPanel.plotCanvas.setActionMode(plotViewer.plotPanel.plotCanvas.SELCENTER); setBorder(BorderFactory.createTitledBorder(title)); add(plotViewer); }
/** * Create plot info panel * * @return panel */ private JPanel createMapPanel() { JPanel panel = new JPanel(new BorderLayout(), true); // create an raised, etched, titled border Border etchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); TitledBorder titledBorder = BorderFactory.createTitledBorder(etchedBorder, "Map"); titledBorder.setTitleJustification(TitledBorder.LEFT); panel.setBorder(titledBorder); // load image java.net.URL imgURL = getClass().getResource("/resources/map.png"); map = new ScrollablePicture(new ImageIcon(imgURL), 10); // map = new ScrollablePicture(new ImageIcon("resources/map.png"), 10); mapScrollPane = new JScrollPane(map); mapScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); mapScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); map.addMouseListener( new MouseListener() { /** * Get the coordinates of a mouse click event * * @param e MouseEvent */ @Override public void mouseClicked(MouseEvent e) { if (cemeteryPlotterFrame.cemeteryPlotterPlot.isEditable()) cemeteryPlotterFrame.cemeteryPlotterPlot.setMapLocationField(e.getPoint()); } @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) { if (cemeteryPlotterFrame.cemeteryPlotterPlot.isEditable()) mapScrollPane.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); } @Override public void mouseExited(MouseEvent e) {} }); // add map scroll pane to main panel panel.add(mapScrollPane, BorderLayout.CENTER); return panel; }
private JComponent makeTitlePanel(String title, List<? extends JComponent> list) { JPanel p = new JPanel(new GridBagLayout()); p.setBorder(BorderFactory.createTitledBorder(title)); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(5, 5, 5, 5); c.weightx = 1d; c.gridy = 0; for (JComponent cmp : list) { p.add(cmp, c); c.gridy++; } return p; }
/** * Constructs a button panel. * * @param title the title shown in the border * @param options an array of radio button labels */ public ButtonPanel(String title, String... options) { setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title)); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); group = new ButtonGroup(); // make one radio button for each option for (String option : options) { JRadioButton b = new JRadioButton(option); b.setActionCommand(option); add(b); group.add(b); b.setSelected(option == options[0]); } }
public MainPanel() { super(new BorderLayout()); l1.setToolTipText("Test1"); l2.setToolTipText("Test2"); l3.setToolTipText("<html><img src='" + url + "'>Test3</html>"); JPanel p1 = new JPanel(new BorderLayout()); p1.setBorder(BorderFactory.createTitledBorder("javax.swing.Timer")); p1.add(l1); JPanel p2 = new JPanel(new BorderLayout()); p2.setBorder(BorderFactory.createTitledBorder("Animated Gif")); p2.add(l2, BorderLayout.NORTH); p2.add(l3, BorderLayout.SOUTH); Box box = Box.createVerticalBox(); box.add(p1); box.add(Box.createVerticalStrut(20)); box.add(p2); box.add(Box.createVerticalGlue()); add(box); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setPreferredSize(new Dimension(320, 240)); }
public ColorChooserDemo() { super(new BorderLayout()); // 设置一个标签,做广告的。也用来显示用户选择的颜色。 banner = new JLabel("欢迎使用颜色选择器!", JLabel.CENTER); banner.setForeground(Color.yellow); banner.setBackground(Color.blue); banner.setOpaque(true); banner.setFont(new Font("SansSerif", Font.BOLD, 24)); banner.setPreferredSize(new Dimension(100, 65)); JPanel bannerPanel = new JPanel(new BorderLayout()); bannerPanel.add(banner, BorderLayout.CENTER); bannerPanel.setBorder(BorderFactory.createTitledBorder("广告")); // 设置选择颜色选择器 tcc = new JColorChooser(banner.getForeground()); // 设置初始颜色 tcc.getSelectionModel().addChangeListener(this); // 给所有模式添加监听 tcc.setBorder(BorderFactory.createTitledBorder("选择颜色")); add(bannerPanel, BorderLayout.CENTER); add(tcc, BorderLayout.PAGE_END); }
protected void layoutUIComponents(String strPath, boolean bDefaultFile) { JLabel label = null; // i18n // label = new JLabel( "File names can be constructed from a template. The LABEL field is " ); label = new JLabel( Util.getAdmLabel( "_admin_File_names_can_be_constructed_from_a_template._The_LABEL_field_is_")); label.setForeground(Color.black); // m_gbc.weightx = 0.5; showInstruction(m_gbl, m_gbc, 0, 0, 7, label); // i18n // label = new JLabel( "presented as the choice to the user in the \"Data save\" pop-up." ); label = new JLabel( Util.getAdmLabel( "_admin_presented_as_the_choice_to_the_user_in_the_Data_save_pop-up.")); showInstruction(m_gbl, m_gbc, 0, 1, 7, label); showInstruction(m_gbl, m_gbc, 0, 2, 1, new JLabel("")); label = new JLabel(Util.getAdmLabel("_adm_LABEL")); label.setForeground(Color.black); m_gbc.gridx = 1; m_gbc.gridy = 2; m_gbc.ipadx = 10; m_gbl.setConstraints(label, m_gbc); m_pnlDisplay.add(label); label = new JLabel(" "); m_gbc.gridx = 2; m_gbc.gridy = 2; m_gbc.ipadx = 0; // reset to default m_gbc.gridwidth = 5; m_gbl.setConstraints(label, m_gbc); // add( label ); showInstruction(m_gbl, m_gbc, 2, 2, 1, new JLabel(Util.getAdmLabel("_admin_TEMPLATE"))); m_nRow = 3; m_bDefaultFile = bDefaultFile; m_objTxfValue.clearArrays(); displayNewTxf(strPath); m_pnlDisplay.setBorder( new CompoundBorder( BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
boolean initControlCenter(String title) { this.setTitle(title); // set up content pane Container content = this.getContentPane(); content.setLayout(new BorderLayout()); panelAbout.setLayout(new BorderLayout()); JTextArea textArea = new JTextArea( "PlayStation 2 Virtual File System release 1.0 \n\nSpecials thanks to our betatester\nPS2Linux Betatester: Mrbrown and Sarah\nPS2 betatester: Oobles, Caveman, Gamebytes, Ping^Spike, Josekenshin, Padawan, pakor, SandraThx and Rolando\n\nAdded little gui in java swing\nAdded feature to choose directory for media files\nAdded support for properties files\nCheck for updates at ps2dev.org\n\nRelease 1.2\n\nRewrite io with java NIO\nadded console mode support\n"); textArea.setEditable(false); JScrollPane areaScrollPane = new JScrollPane(textArea); areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); areaScrollPane.setPreferredSize(new Dimension(250, 250)); TitledBorder aboutBorder = BorderFactory.createTitledBorder("Change log and Greets"); aboutBorder.setTitleColor(Color.blue); panelAbout.setBorder(aboutBorder); panelAbout.add(areaScrollPane); // set up tabbed pane content.add(jtpMain); jtpMain.addTab("Configure", panelChooser); jtpMain.addTab("About", panelAbout); // set up display area // jtaDisplay.setEditable(false); // jtaDisplay.setLineWrap(true); // jtaDisplay.setMargin(new Insets(5, 5, 5, 5)); // jtaDisplay.setFont( // new Font("Monospaced", Font.PLAIN, iDEFAULT_FontSize)); // jspDisplay.setViewportView(jtaDisplay); // jspDisplay.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); // panelConsole.add(jspDisplay, BorderLayout.CENTER); // panelConsole.add(jtfCommand, BorderLayout.SOUTH); // panelConsole.add(jtaDisplay, BorderLayout.CENTER); // listener: window closer this.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); this.vResize(); return true; }
public PerceptronMain() { setPreferredSize(new java.awt.Dimension(250, 200)); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(screenSize.width / 2, screenSize.height / 2); // Establecemos el tipo de layout setLayout(new BorderLayout()); // Etiqueta de informacion labelInfo = new JLabel("Elija una de las dos opciones a ejecutar"); erreTrabajo.setDocument(new controlarLontigud(2, true)); // Crea el panel de botones buttonPanel = createButtonPanel(); /* Creamos un layout propio para los controles anteriores */ GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); // Establecemos la rejilla textControlsPane.setLayout(gridbag); // Por comodidad, creamos una funcion que aniada los controles a la rejilla // y al panel que la contiene... c.gridwidth = GridBagConstraints.REMAINDER; // last c.anchor = GridBagConstraints.EAST; c.weightx = 10.0; // Agregamos la etiqueta labelInfo al panel. textControlsPane.add(labelInfo, c); JLabel[] labels = {erreTrabajoLbl}; JTextField[] textFields = {erreTrabajo}; // Colocamos en el panel las etiquetas y los textfields. addLabelTextRows(labels, textFields, gridbag, textControlsPane); // Agregamos al panel los botones. textControlsPane.add(buttonPanel, c); // Situados los demas elementos, colocamos la etiqueta informativa textControlsPane.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("RNAG - Perceptrón | Adaline"), BorderFactory.createEmptyBorder(5, 5, 5, 5))); // A�adimos el panel en la zona "LINE_START" al principio... add(textControlsPane, BorderLayout.LINE_START); } // fin_MiLogin()
protected JPanel makeControlPanel() { JPanel innerPanel = new JPanel(new GridLayout(8, 1)); innerPanel.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Go To"), BorderFactory.createEmptyBorder(5, 5, 5, 5))); for (PathAction pa : pathActions) { JButton btn = new JButton(pa); innerPanel.add(btn); } JPanel cp = new JPanel(new BorderLayout()); cp.add(innerPanel, BorderLayout.CENTER); return cp; }
VerificationDlg(JFrame par, String pwd) { super(par, "Password Keeper - Enter Password", true); // Modal Dialog this.par = par; this.pwd = pwd; okButton = new JButton("OK"); okButton.addActionListener(this); dlgPanel = new JPanel(); dlgPanel.setLayout(new GridBagLayout()); cns = new GridBagConstraints(); cns.gridx = cns.gridy = 0; cns.insets = new Insets(2, 2, 2, 2); dlgPanel.add(new JLabel("Password"), cns); cns.gridx++; passField = new TextField(30); dlgPanel.add(passField, cns); cns.gridy++; // cns.gridx = 0; dlgPanel.add(okButton, cns); cancelButton = new JButton("Cancel"); cns.gridx++; dlgPanel.add(cancelButton, cns); Container cp = this.getContentPane(); Border rb = BorderFactory.createEtchedBorder(); dlgPanel.setBorder( BorderFactory.createTitledBorder( rb, "Enter Password", TitledBorder.LEFT, TitledBorder.TOP)); cp.add(dlgPanel); pack(); }