/** @param frameName title name for frame */ public ShowSavedResults(String frameName) { super(frameName); aboutRes = new JTextArea( "Select a result set from" + "\nthose listed and details" + "\nof that analysis will be" + "\nshown here. Then you can" + "\neither delete or view those" + "\nresults using the buttons below."); aboutScroll = new JScrollPane(aboutRes); ss = new JScrollPane(sp); ss.getViewport().setBackground(Color.white); // resMenu.setLayout(new FlowLayout(FlowLayout.LEFT,10,1)); ClassLoader cl = getClass().getClassLoader(); rfii = new ImageIcon(cl.getResource("images/Refresh_button.gif")); // results status resButtonStatus = new JPanel(new BorderLayout()); Border loweredbevel = BorderFactory.createLoweredBevelBorder(); Border raisedbevel = BorderFactory.createRaisedBevelBorder(); Border compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel); statusField = new JTextField(); statusField.setBorder(compound); statusField.setEditable(false); }
public FileNameRenderer(JTable table) { Border b = UIManager.getBorder("Table.noFocusBorder"); if (Objects.isNull(b)) { // Nimbus??? Insets i = focusCellHighlightBorder.getBorderInsets(textLabel); b = BorderFactory.createEmptyBorder(i.top, i.left, i.bottom, i.right); } noFocusBorder = b; p.setOpaque(false); panel.setOpaque(false); // http://www.icongalore.com/ XP Style Icons - Windows Application Icon, Software XP Icons nicon = new ImageIcon(getClass().getResource("wi0063-16.png")); sicon = new ImageIcon( p.createImage( new FilteredImageSource(nicon.getImage().getSource(), new SelectedImageFilter()))); iconLabel = new JLabel(nicon); iconLabel.setBorder(BorderFactory.createEmptyBorder()); p.add(iconLabel, BorderLayout.WEST); p.add(textLabel); panel.add(p, BorderLayout.WEST); Dimension d = iconLabel.getPreferredSize(); dim.setSize(d); table.setRowHeight(d.height); }
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))); }
// Component initialization private void jbInit() throws Exception { image1 = new ImageIcon(com.worldwizards.nwn.resbrowse.MainFrame.class.getResource("about.png")); imageLabel.setIcon(image1); this.setTitle("About"); panel1.setLayout(borderLayout1); panel2.setLayout(borderLayout2); insetsPanel1.setLayout(flowLayout1); insetsPanel2.setLayout(flowLayout1); insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); gridLayout1.setRows(4); gridLayout1.setColumns(1); label1.setText(product); label2.setText(version); label3.setText(copyright); label4.setText(comments); insetsPanel3.setLayout(gridLayout1); insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 60, 10, 10)); button1.setText("Ok"); button1.addActionListener(this); insetsPanel2.add(imageLabel, null); panel2.add(insetsPanel2, BorderLayout.WEST); this.getContentPane().add(panel1, null); insetsPanel3.add(label1, null); insetsPanel3.add(label2, null); insetsPanel3.add(label3, null); insetsPanel3.add(label4, null); panel2.add(insetsPanel3, BorderLayout.CENTER); insetsPanel1.add(button1, null); panel1.add(insetsPanel1, BorderLayout.SOUTH); panel1.add(panel2, BorderLayout.NORTH); setResizable(true); }
protected void initComponents() { int border = 2; this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); // Description label JPanel descriptionPanel = new JPanel(new GridLayout(0, 1, 0, 0)); descriptionPanel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border)); String text = thread.getRetrievable().getName(); text = text.length() > 40 ? text.substring(0, 37) + "..." : text; descriptionLabel = new JLabel(text); descriptionPanel.add(descriptionLabel); this.add(descriptionPanel); // Progrees and cancel button JPanel progressPanel = new JPanel(); progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.X_AXIS)); progressPanel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border)); progressBar = new JProgressBar(0, 100); progressBar.setPreferredSize(new Dimension(100, 16)); progressPanel.add(progressBar); progressPanel.add(Box.createHorizontalStrut(8)); cancelButton = new JButton("Cancel"); cancelButton.setBackground(Color.RED); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { cancelButtonActionPerformed(event); } }); progressPanel.add(cancelButton); this.add(progressPanel); }
public class MyListCellRenderer implements ListCellRenderer { private JLabel jlblCell = new JLabel(" ", JLabel.LEFT); private Border lineBorder = BorderFactory.createLineBorder(Color.black, 1); private Border emptyBorder = BorderFactory.createEmptyBorder(2, 2, 2, 2); /** Implement this method in ListCellRenderer */ public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Object[] pair = (Object[]) value; // Cast value into an array jlblCell.setOpaque(true); jlblCell.setIcon((ImageIcon) pair[0]); jlblCell.setText(pair[1].toString()); if (isSelected) { jlblCell.setForeground(list.getSelectionForeground()); jlblCell.setBackground(list.getSelectionBackground()); } else { jlblCell.setForeground(list.getForeground()); jlblCell.setBackground(list.getBackground()); } jlblCell.setBorder(cellHasFocus ? lineBorder : emptyBorder); return jlblCell; } }
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))); }
private MainPanel() { super(new GridLayout(3, 1, 5, 5)); final JTree tree = new JTree(); final JCheckBox c = new JCheckBox("CheckBox", true); c.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tree.setEnabled(c.isSelected()); } }); c.setFocusPainted(false); JScrollPane l1 = new JScrollPane(tree); l1.setBorder(new ComponentTitledBorder(c, l1, BorderFactory.createEtchedBorder())); JLabel icon = new JLabel(new ImageIcon(getClass().getResource("16x16.png"))); JLabel l2 = new JLabel("<html>aaaaaaaaaaaaaaaa<br>bbbbbbbbbbbbbbbbb"); l2.setBorder(new ComponentTitledBorder(icon, l2, BorderFactory.createEtchedBorder())); JButton b = new JButton("Button"); b.setFocusPainted(false); JLabel l3 = new JLabel("ccccccccccccccc"); l3.setBorder(new ComponentTitledBorder(b, l3, BorderFactory.createEtchedBorder())); add(l1); add(l2); add(l3); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setPreferredSize(new Dimension(320, 240)); }
@Override protected void changeBorder() { int flags; Border empty = BorderFactory.createEmptyBorder(); int iInsets = bSmallTitle ? 0 : 2; if (getOrientation().isHorizontal()) { flags = CEclipseBorder.TOP_RIGHT | CEclipseBorder.BOTTOM_RIGHT; empty = new EmptyBorder(iInsets, 2, iInsets, 4); } else { flags = CEclipseBorder.BOTTOM_LEFT | CEclipseBorder.BOTTOM_RIGHT; empty = new EmptyBorder(2, iInsets, 4, iInsets); } Border border = new CEclipseBorder(getOrigin().getController(), 6, flags); Insets ins = getOutsideInsets(); Border b = new CompoundBorder( BorderFactory.createEmptyBorder(ins.top, ins.left, ins.bottom, ins.right), new CompoundBorder(border, empty)); setBorder(ThemeManager.BORDER_MODIFIER + ".title.eclipse.button.flat", b); }
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(); }
public void createColorPanel() { JPanel colorPanel = new JPanel(new GridLayout(0, 1)); int curRow = 0; for (int i = 0; i < colorString.length / 5; i++) { JPanel row = new JPanel(new GridLayout(1, 0, 2, 1)); row.setBorder(new EmptyBorder(2, 2, 2, 2)); for (int j = curRow; j < curRow + 5; j++) { final JLabel colorLabel = new JLabel(null, new ColoredIcon(color[j], 14, 14), JLabel.CENTER); colorLabel.setOpaque(true); final Border emb = BorderFactory.createEmptyBorder(2, 1, 2, 1); final Border lnb = BorderFactory.createLineBorder(Color.black); final Border cmb = BorderFactory.createCompoundBorder(lnb, emb); colorLabel.setBorder(emb); colorLabel.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { JButton btn = (JButton) getTarget(); Color selColor = ((ColoredIcon) colorLabel.getIcon()).getCurrentColor(); btn.setIcon(new ColoredIcon(selColor)); setVisible(false); btn.doClick(); oldLabel.setBackground(null); colorLabel.setBackground(new Color(150, 150, 200)); colorLabel.setBorder(emb); oldLabel = colorLabel; } public void mouseEntered(MouseEvent e) { colorLabel.setBorder(cmb); colorLabel.setBackground(new Color(150, 150, 200)); } public void mouseExited(MouseEvent e) { colorLabel.setBorder(emb); colorLabel.setBackground(null); } }); row.add(colorLabel); } colorPanel.add(row); curRow += row.getComponentCount(); // System.out.println(curRow); } add(colorPanel, BorderLayout.CENTER); // More Colors Button moreColors = new JButton(new ColorChooserAction((JButton) target)); moreColors.setText("More Colors..."); moreColors.setIcon(null); moreColors.setFont(new Font("Verdana", Font.PLAIN, 10)); // JPanel c = new JPanel(new FlowLayout(FlowLayout.CENTER)); c.add(moreColors); add(c, BorderLayout.SOUTH); }
/* *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 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 MessageLabel() { // setMinimumSize(new Dimension(16, 16)); setFont(getFont().deriveFont(Font.PLAIN)); setText(" "); Border empty = BorderFactory.createEmptyBorder(2, 2, 2, 2); Border bevel = new SoftBevelBorder(SoftBevelBorder.LOWERED); setBorder(BorderFactory.createCompoundBorder(bevel, empty)); setMessage(MessageLabel.INFO, "To begin, click on \"New Block\" to create blocks."); }
public ComboBoxDemo2() { setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); String[] patternExamples = { "dd MMMMM yyyy", "dd.MM.yy", "MM/dd/yy", "yyyy.MM.dd G 'at' hh:mm:ss z", "EEE, MMM d, ''yy", "h:mm a", "H:mm:ss:SSS", "K:mm a,z", "yyyy.MMMMM.dd GGG hh:mm aaa" }; currentPattern = patternExamples[0]; // Set up the UI for selecting a pattern. JLabel patternLabel1 = new JLabel("Enter the pattern string or"); JLabel patternLabel2 = new JLabel("select one from the list:"); JComboBox patternList = new JComboBox(patternExamples); patternList.setEditable(true); patternList.addActionListener(this); // Create the UI for displaying result. JLabel resultLabel = new JLabel("Current Date/Time", JLabel.LEADING); // == LEFT result = new JLabel(" "); result.setForeground(Color.black); result.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(Color.black), BorderFactory.createEmptyBorder(5, 5, 5, 5))); // Lay out everything. JPanel patternPanel = new JPanel(); patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS)); patternPanel.add(patternLabel1); patternPanel.add(patternLabel2); patternList.setAlignmentX(Component.LEFT_ALIGNMENT); patternPanel.add(patternList); JPanel resultPanel = new JPanel(new GridLayout(0, 1)); resultPanel.add(resultLabel); resultPanel.add(result); patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT); resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT); add(patternPanel); add(Box.createRigidArea(new Dimension(0, 10))); add(resultPanel); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); reformat(); } // constructor
public AppFrame() { // Create the WorldWindow. this.wwjPanel = new ApplicationTemplate.AppPanel(this.canvasSize, true); this.wwjPanel.setPreferredSize(canvasSize); ApplicationTemplate.insertBeforePlacenames(this.wwjPanel.getWwd(), layer); JPanel shapesPanel = makeShapeSelectionPanel(); shapesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel attrsPanel = makeAttributesPanel(); attrsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); // Put the pieces together. JPanel controlPanel = new JPanel(new BorderLayout()); controlPanel.add(shapesPanel, BorderLayout.CENTER); JPanel p = new JPanel(new BorderLayout(6, 6)); p.add(attrsPanel, BorderLayout.CENTER); controlPanel.add(p, BorderLayout.SOUTH); this.getContentPane().add(wwjPanel, BorderLayout.CENTER); this.getContentPane().add(controlPanel, BorderLayout.WEST); this.pack(); // Center the application on the screen. Dimension prefSize = this.getPreferredSize(); Dimension parentSize; java.awt.Point parentLocation = new java.awt.Point(0, 0); parentSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = parentLocation.x + (parentSize.width - prefSize.width) / 2; int y = parentLocation.y + (parentSize.height - prefSize.height) / 2; this.setLocation(x, y); this.setResizable(true); wwjPanel .getWwd() .addRenderingListener( new RenderingListener() { public void stageChanged(RenderingEvent event) { if (!event.getStage().equals(RenderingEvent.BEFORE_BUFFER_SWAP)) return; if (currentShape instanceof Polyline) { Polyline p = (Polyline) currentShape; String length = Double.toString(p.getLength()); textRenderer.beginRendering(wwjPanel.getWidth(), wwjPanel.getHeight()); textRenderer.draw(length, 100, 100); textRenderer.endRendering(); } } }); // Enable dragging and other selection responses this.setupSelection(); }
public void actionPerformed(ActionEvent e) { for (int k = 0; k <= 4; k++) { // 先將全部顏色按鈕還原為浮凸狀 btnCr[k].setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); if (e.getSource() == btnCr[k]) { pane.setBackground(cr[k]); // 被點按的顏色按鈕呈凹陷狀 btnCr[k].setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); } } }
/** * 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; }
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))); }
private Qizi() { isDead = false; this.setBorder(BorderFactory.createRaisedBevelBorder()); this.setBorderPainted(false); this.setOpaque(false); this.setVisible(false); }
StatsPanel(String title) { TitledBorder tBorder = BorderFactory.createTitledBorder(title); setBorder(tBorder); setLayout(new GridLayout(0, 2)); minLabel = new JLabel("Min"); min = new JLabel("" + 0); meanLabel = new JLabel("Mean"); mean = new JLabel("" + 0); maxLabel = new JLabel("Max"); max = new JLabel("" + 0); stdDevLabel = new JLabel("StdDev"); stdDev = new JLabel("" + 0); add(minLabel); add(min); add(meanLabel); add(mean); add(maxLabel); add(max); add(stdDevLabel); add(stdDev); setSize(width, height); setMinimumSize(new Dimension(width, height)); }
private void jbInit() throws Exception { border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20); contentPane.setBorder(border1); contentPane.setLayout(borderLayout1); controlsPane.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setHgap(10); gridLayout1.setRows(0); gridLayout1.setVgap(10); okButton.setVerifyInputWhenFocusTarget(true); okButton.setMnemonic('O'); okButton.setText("OK"); buttonsPane.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.CENTER); messagePane.setEditable(false); messagePane.setText(""); borderLayout1.setHgap(10); borderLayout1.setVgap(10); this.setTitle("Subscription Authorization"); this.getContentPane().add(contentPane, BorderLayout.CENTER); contentPane.add(controlsPane, BorderLayout.SOUTH); controlsPane.add(responsesComboBox, null); controlsPane.add(buttonsPane, null); buttonsPane.add(okButton, null); contentPane.add(messageScrollPane, BorderLayout.CENTER); messageScrollPane.getViewport().add(messagePane, null); }
public PropertyPanel(String title, Properties properties) { super(); setBorder(new TitledBorder(BorderFactory.createEtchedBorder(), title)); setLayout(new GridLayout(1, 1, 10, 10)); JTextArea area = new JTextArea(Math.min(properties.size(), 20), 40); area.setEditable(false); area.setOpaque(false); area.setTabSize(16); Iterator iter = properties.keySet().iterator(); if (iter.hasNext()) { // first line String key = (String) iter.next(); area.append(key); area.append("\t"); area.append(properties.getProperty(key)); } while (iter.hasNext()) { // remaining lines area.append("\n"); String key = (String) iter.next(); area.append(key); area.append("\t"); area.append(properties.getProperty(key)); } add(new JScrollPane(area)); }
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 MutableStatusBar(String s1, String s2, String s3) { super(); status_1 = new JLabel(s1); * status_2 = new JLabel(s2); status_3 = new JLabel(s3); this.init(); }. */ protected void init() { this.setLayout(new GridBagLayout()); this.setBorder(BorderFactory.createEmptyBorder(3, 2, 1, 1)); final GridBagConstraints constraints = new GridBagConstraints(); // status_1.setHorizontalAlignment(JLabel.CENTER); status_1.setBorder( new CompoundBorder( new SoftBevelBorder(SoftBevelBorder.LOWERED), new EmptyBorder(0, 2, 0, 2))); status_1.setPreferredSize(new Dimension(180, 16)); status_2.setBorder( new CompoundBorder( new SoftBevelBorder(SoftBevelBorder.LOWERED), new EmptyBorder(0, 2, 0, 2))); status_2.setPreferredSize(new Dimension(200, 16)); status_3.setBorder( new CompoundBorder( new SoftBevelBorder(SoftBevelBorder.LOWERED), new EmptyBorder(0, 2, 0, 2))); status_3.setPreferredSize(new Dimension(300, 16)); greenStatusIcon = new MutableImageLabel(resource.getIcon("green_off.gif"), resource.getIcon("green_on.gif")); greenStatusIcon.setBorder(new EmptyBorder(2, 2, 2, 1)); redStatusIcon = new MutableImageLabel(resource.getIcon("red_off.gif"), resource.getIcon("red_on.gif")); redStatusIcon.setBorder(new EmptyBorder(2, 1, 2, 3)); // ===================================================================== constraints.insets = new Insets(0, 0, 0, 4); constraints.anchor = GridBagConstraints.EAST; constraints.fill = GridBagConstraints.VERTICAL; constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 1; constraints.gridheight = 1; this.add(status_1, constraints); constraints.weightx = 0.0; constraints.gridx++; this.add(status_2, constraints); constraints.gridx = 2; this.add(status_3, constraints); constraints.gridx++; if (greenStatusIcon != null) { this.add(greenStatusIcon, constraints); } constraints.insets = new Insets(0, 0, 0, 0); constraints.gridx++; if (redStatusIcon != null) { this.add(redStatusIcon, constraints); } }
private JComponent makeTitledPanel(String title, JTree tree) { JPanel p = new JPanel(new BorderLayout()); p.setBorder(BorderFactory.createTitledBorder(title)); p.add(new JScrollPane(tree)); tree.setRowHeight(0); return p; }
public ColorPane() { super(); Font font = new Font("Monospaced", Font.PLAIN, 12); FontMetrics fm = getFontMetrics(font); lineHeight = fm.getHeight(); setFont(font); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); }
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(); }
/** * Gets the progress bar border. * * @return the progress bar border */ public static Border getProgressBarBorder() { if (progressBarBorder == null) { progressBarBorder = BorderFactory.createLineBorder( ColorHelper.darker(AbstractLookAndFeel.getBackgroundColor(), 30)); } return progressBarBorder; }
public ConverterPanel(CFrame F, ConvertibleValue CV) { super(new GridBagLayout()); // call to super must be first statement in constructor setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.blue)); frame = F; cValue = CV; preferedSize = new Dimension(100, 40); setBackground(white); } // constructor