List of usage examples for javax.swing JPanel setBorder
@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.") public void setBorder(Border border)
From source file:com.hp.alm.ali.idea.cfg.AliConfigurable.java
protected void addAdditionalSettings(JPanel panel, GridBagConstraints c) { c.gridx = 0;/*ww w. j ava2s . c o m*/ c.gridy++; JPanel spacer = new JPanel(); spacer.setOpaque(false); spacer.setBorder(new EmptyBorder(10, 0, 0, 0)); panel.add(spacer, c); spellChecker = new JCheckBox("Enable spell checker"); spellChecker.setSelected(aliConfiguration.spellChecker); if (!SpellCheckerManager.isAvailable()) { spellChecker.setEnabled(false); spellChecker.setToolTipText("feature not available for this IDE version"); } c.gridx = 1; c.gridy++; c.gridwidth = 3; panel.add(spellChecker, c); devMotiveAnnotation = new JCheckBox("Enable annotations"); devMotiveAnnotation.setSelected(aliConfiguration.devMotiveAnnotation); c.gridy++; panel.add(devMotiveAnnotation, c); }
From source file:FocusTraversalDemo.java
public FocusTraversalDemo() { super(new BorderLayout()); JTextField tf1 = new JTextField("Field 1"); JTextField tf2 = new JTextField("A Bigger Field 2"); JTextField tf3 = new JTextField("Field 3"); JTextField tf4 = new JTextField("A Bigger Field 4"); JTextField tf5 = new JTextField("Field 5"); JTextField tf6 = new JTextField("A Bigger Field 6"); JTable table = new JTable(4, 3); togglePolicy = new JCheckBox("Custom FocusTraversalPolicy"); togglePolicy.setActionCommand("toggle"); togglePolicy.addActionListener(this); togglePolicy.setFocusable(false); // Remove it from the focus cycle. // Note that HTML is allowed and will break this run of text // across two lines. label = new JLabel( "<html>Use Tab (or Shift-Tab) to navigate from component to component.Control-Tab (or Control-Shift-Tab) allows you to break out of the JTable.</html>"); JPanel leftTextPanel = new JPanel(new GridLayout(3, 2)); leftTextPanel.add(tf1, BorderLayout.PAGE_START); leftTextPanel.add(tf3, BorderLayout.CENTER); leftTextPanel.add(tf5, BorderLayout.PAGE_END); leftTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5)); JPanel rightTextPanel = new JPanel(new GridLayout(3, 2)); rightTextPanel.add(tf2, BorderLayout.PAGE_START); rightTextPanel.add(tf4, BorderLayout.CENTER); rightTextPanel.add(tf6, BorderLayout.PAGE_END); rightTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5)); JPanel tablePanel = new JPanel(new GridLayout(0, 1)); tablePanel.add(table, BorderLayout.CENTER); tablePanel.setBorder(BorderFactory.createEtchedBorder()); JPanel bottomPanel = new JPanel(new GridLayout(2, 1)); bottomPanel.add(togglePolicy, BorderLayout.PAGE_START); bottomPanel.add(label, BorderLayout.PAGE_END); add(leftTextPanel, BorderLayout.LINE_START); add(rightTextPanel, BorderLayout.CENTER); add(tablePanel, BorderLayout.LINE_END); add(bottomPanel, BorderLayout.PAGE_END); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); Vector<Component> order = new Vector<Component>(7); order.add(tf1);/*from ww w . j a v a2 s . c o m*/ order.add(tf2); order.add(tf3); order.add(tf4); order.add(tf5); order.add(tf6); order.add(table); newPolicy = new MyOwnFocusTraversalPolicy(order); }
From source file:es.emergya.ui.gis.popups.ListaCapas.java
private ListaCapas(CustomMapView mapView, final IMapViewer historyMapViewer) { super();//from www . j a v a2 s .c om setTitle(i18n.getString("window.gpx.titleBar")); setLocationRelativeTo(getBasicWindow().getFrame()); setResizable(false); setAlwaysOnTop(true); this.mapView = mapView; this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setIconImage(getBasicWindow().getFrame().getIconImage()); JPanel dialogo = new JPanel(new BorderLayout()); dialogo.setBackground(Color.WHITE); dialogo.setBorder(new EmptyBorder(10, 10, 10, 10)); capasGpx = new JPanel(); capasGpx.setBackground(Color.WHITE); capasGpx.setLayout(new BoxLayout(capasGpx, BoxLayout.Y_AXIS)); JScrollPane lista = new JScrollPane(capasGpx); lista.setOpaque(false); lista.setBorder(new TitledBorder(i18n.getString("window.gpx.title"))); dialogo.add(lista, BorderLayout.CENTER); JPanel boton = new JPanel(new FlowLayout()); boton.setOpaque(false); JButton cargar = getCargarGPXButton(); boton.add(cargar, FlowLayout.LEFT); dialogo.add(boton, BorderLayout.SOUTH); add(dialogo); setPreferredSize(new Dimension(400, 250)); pack(); setLocationRelativeTo((Component) mapView); this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { super.windowClosed(e); // historyMapViewer.getGPXButton().setSelected(false); } }); }
From source file:com.vrane.metaGlacier.gui.MetaDataSignUpDialog.java
MetaDataSignUpDialog() { super(Main.frame, true); JPanel signUpPanel = new JPanel(new GridLayout(4, 2)); final JTextField nameJT = new JTextField(10); final JTextField emailJT = new JTextField(10); final JTextField emailJT1 = new JTextField(10); final JButton signUpButton = new JButton("Sign up"); signUpPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 5)); signUpPanel.add(new JLabel("name (optional)")); signUpPanel.add(nameJT);//from w w w .j ava 2 s.c o m signUpPanel.add(new JLabel("email")); signUpPanel.add(emailJT); signUpPanel.add(new JLabel("email again")); signUpPanel.add(emailJT1); signUpPanel.add(new JLabel()); signUpPanel.add(signUpButton); signUpButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { final String email = emailJT.getText(); final String email1 = emailJT1.getText(); final String name = nameJT.getText(); boolean success = false; if (!email.equals(email1)) { JOptionPane.showMessageDialog(null, "Email addresses do not match"); return; } if (!EmailValidator.getInstance().isValid(email)) { JOptionPane.showMessageDialog(null, "Invalid email address"); return; } try { success = new SignUp().signup(email, name); } catch (SDKException ex) { LGR.log(Level.SEVERE, null, ex); } if (success) { JOptionPane.showMessageDialog(null, "Please check your email to confirm"); dispose(); return; } JOptionPane.showMessageDialog(null, "Error signing up"); } }); add(signUpPanel); pack(); setLocationRelativeTo(Main.frame); setVisible(true); }
From source file:DropDemo.java
private JPanel createList() { DefaultListModel listModel = new DefaultListModel(); for (int i = 0; i < 10; i++) { listModel.addElement("List Item " + i); }// w ww. j a v a2s . c o m list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); JScrollPane scrollPane = new JScrollPane(list); scrollPane.setPreferredSize(new Dimension(400, 100)); list.setDragEnabled(true); list.setTransferHandler(new ListTransferHandler()); dropCombo = new JComboBox(new String[] { "USE_SELECTION", "ON", "INSERT", "ON_OR_INSERT" }); dropCombo.addActionListener(this); JPanel dropPanel = new JPanel(); dropPanel.add(new JLabel("List Drop Mode:")); dropPanel.add(dropCombo); JPanel panel = new JPanel(new BorderLayout()); panel.add(scrollPane, BorderLayout.CENTER); panel.add(dropPanel, BorderLayout.SOUTH); panel.setBorder(BorderFactory.createTitledBorder("List")); return panel; }
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultNumberAxisEditor.java
/** * Standard constructor: builds a property panel for the specified axis. * // w w w .j a va 2 s . c om * @param axis * the axis, which should be changed. */ public DefaultNumberAxisEditor(NumberAxis axis) { super(axis); this.autoRange = axis.isAutoRange(); this.minimumValue = axis.getLowerBound(); this.maximumValue = axis.getUpperBound(); this.gridPaintSample = new PaintSample(Color.blue); this.gridStrokeSample = new StrokeSample(new BasicStroke(1.0f)); this.availableStrokeSamples = new StrokeSample[3]; this.availableStrokeSamples[0] = new StrokeSample(new BasicStroke(1.0f)); this.availableStrokeSamples[1] = new StrokeSample(new BasicStroke(2.0f)); this.availableStrokeSamples[2] = new StrokeSample(new BasicStroke(3.0f)); JTabbedPane other = getOtherTabs(); JPanel range = new JPanel(new LCBLayout(3)); range.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); range.add(new JPanel()); this.autoRangeCheckBox = new JCheckBox(localizationResources.getString("Auto-adjust_range"), this.autoRange); this.autoRangeCheckBox.setActionCommand("AutoRangeOnOff"); this.autoRangeCheckBox.addActionListener(this); range.add(this.autoRangeCheckBox); range.add(new JPanel()); range.add(new JLabel(localizationResources.getString("Minimum_range_value"))); this.minimumRangeValue = new JTextField(Double.toString(this.minimumValue)); this.minimumRangeValue.setEnabled(!this.autoRange); this.minimumRangeValue.setActionCommand("MinimumRange"); this.minimumRangeValue.addActionListener(this); this.minimumRangeValue.addFocusListener(this); range.add(this.minimumRangeValue); range.add(new JPanel()); range.add(new JLabel(localizationResources.getString("Maximum_range_value"))); this.maximumRangeValue = new JTextField(Double.toString(this.maximumValue)); this.maximumRangeValue.setEnabled(!this.autoRange); this.maximumRangeValue.setActionCommand("MaximumRange"); this.maximumRangeValue.addActionListener(this); this.maximumRangeValue.addFocusListener(this); range.add(this.maximumRangeValue); range.add(new JPanel()); other.add(localizationResources.getString("Range"), range); }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.LinkUnlinkWindow.java
private JPanel getBorderedThrobber(final ThrobberBarWithText throbber) { final JPanel borderedThrobber = new JPanel(new BorderLayout()); borderedThrobber.add(throbber, BorderLayout.CENTER); borderedThrobber.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); return borderedThrobber; }
From source file:com.digitalgeneralists.assurance.ui.components.FileAttributesPanel.java
private void initializeComponent() { if (!this.initialized) { if (this.file == null) { this.dialogTitle = "No File Provided"; this.file = null; } else {//from w w w. j ava2 s .c o m StringBuilder title = new StringBuilder(128); this.dialogTitle = title.append("Attributes for ").append(file.getFile().getName()).toString(); title.setLength(0); title = null; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); GridBagConstraints filePanelConstraints = new GridBagConstraints(); filePanelConstraints.anchor = GridBagConstraints.NORTH; filePanelConstraints.fill = GridBagConstraints.HORIZONTAL; filePanelConstraints.gridx = 0; filePanelConstraints.gridy = 0; filePanelConstraints.weightx = 1.0; filePanelConstraints.weighty = 0.1; filePanelConstraints.gridheight = 1; filePanelConstraints.gridwidth = 1; filePanelConstraints.insets = new Insets(5, 5, 5, 5); final JPanel filePanel = new JPanel(); filePanel.setLayout(new GridBagLayout()); GridBagConstraints filePathValueConstraints = new GridBagConstraints(); filePathValueConstraints.anchor = GridBagConstraints.WEST; filePathValueConstraints.gridx = 0; filePathValueConstraints.gridy = 0; filePathValueConstraints.weightx = 1.0; filePathValueConstraints.weighty = 1.0; filePathValueConstraints.gridheight = 1; filePathValueConstraints.gridwidth = 1; filePathValueConstraints.insets = new Insets(5, 5, 5, 5); String filePath = "File is null."; if (file != null) { File diskFile = file.getFile(); if (diskFile == null) { filePath = "The disk file is not set."; } else { filePath = diskFile.getPath(); } diskFile = null; } JLabel filePathValue = new JLabel(filePath); filePath = null; filePanel.add(filePathValue, filePathValueConstraints); this.add(filePanel, filePanelConstraints); Border attributesBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); attributesBorder = BorderFactory.createTitledBorder(attributesBorder, "File Attributes", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints attributesPanelConstraints = new GridBagConstraints(); attributesPanelConstraints.anchor = GridBagConstraints.SOUTH; attributesPanelConstraints.fill = GridBagConstraints.BOTH; attributesPanelConstraints.gridx = 0; attributesPanelConstraints.gridy = 1; attributesPanelConstraints.weightx = 1.0; attributesPanelConstraints.weighty = 0.9; attributesPanelConstraints.gridheight = 1; attributesPanelConstraints.gridwidth = 1; attributesPanelConstraints.insets = new Insets(0, 5, 5, 5); JPanel attributesPanel = this.createFileAttributesPanel(file); attributesPanel.setBorder(attributesBorder); this.add(attributesPanel, attributesPanelConstraints); this.initialized = true; } }
From source file:com.k42b3.sacmis.Sacmis.java
public Sacmis(String path, String file, int exitCode, boolean writerStdIn) throws Exception { this.path = path; this.file = file; this.exitCode = exitCode; this.writerStdIn = writerStdIn; this.setTitle("sacmis (version: " + ver + ")"); this.setLocation(100, 100); this.setSize(600, 500); this.setMinimumSize(this.getSize()); // arguments/*from w w w .ja v a 2 s. co m*/ JPanel panelArgs = new JPanel(); panelArgs.setLayout(new BorderLayout()); panelArgs.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); this.args = new Args(); this.args.setText(file); panelArgs.add(this.args, BorderLayout.CENTER); this.add(panelArgs, BorderLayout.NORTH); // main panel JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT); this.in = new In(); JScrollPane scrIn = new JScrollPane(this.in); scrIn.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); scrIn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrIn.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp.add(scrIn); this.out = new Out(); JScrollPane scrOut = new JScrollPane(this.out); scrOut.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); scrOut.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrOut.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp.add(scrOut); this.add(sp, BorderLayout.CENTER); // toolbar this.toolbar = new Toolbar(); this.toolbar.getRun().addActionListener(new runHandler()); this.toolbar.getReset().addActionListener(new resetHandler()); this.toolbar.getAbout().addActionListener(new aboutHandler()); this.toolbar.getExit().addActionListener(new exitHandler()); this.getContentPane().add(this.toolbar, BorderLayout.SOUTH); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.loadFile(); }
From source file:GCWrapper.java
/** * Creates and lays out components in the container. See the comments below * for an organizational overview by panel. *//*from www .ja v a2 s.c om*/ private void initComponents(Container c) { // +=c=====================================================+ // ++=gcPanel==============================================+ // ++ [gcSelection] + // ++=capsPanel============================================+ // +++=imageCapsPanel======================================+ // +++ [imageAccelerated] + // +++ [imageTrueVolatile] + // +++=bufferCapsPanel=====================================+ // ++++=bufferAccessCapsPanel==============================+ // +++++=flippingPanel=====================================+ // +++++ [flipping] + // +++++=fsPanel===========================================+ // +++++ [indentPanel][fullScreen] + // +++++=mbPanel===========================================+ // +++++ [indentPanel][multiBuffer] + // ++++=buffersPanel=======================================+ // +++++=fbPanel===============+=bbPanel===================+ // +++++ + + // +++++ [fbAccelerated] + [bbAccelerated] + // +++++ + + // +++++ [fbTrueVolatile] + [bbTrueVolatile] + // +++++ + + // +=======================================================+ c.setLayout(new BorderLayout()); // Graphics Config JPanel gcPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); c.add(gcPanel, BorderLayout.NORTH); gcSelection.setPreferredSize(new Dimension(400, 30)); gcPanel.add(gcSelection); // Capabilities JPanel capsPanel = new JPanel(new BorderLayout()); c.add(capsPanel, BorderLayout.CENTER); // Image Capabilities JPanel imageCapsPanel = new JPanel(new GridLayout(2, 1)); capsPanel.add(imageCapsPanel, BorderLayout.NORTH); imageCapsPanel.setBorder(BorderFactory.createTitledBorder("Image Capabilities")); imageAccelerated.setEnabled(false); imageCapsPanel.add(imageAccelerated); imageTrueVolatile.setEnabled(false); imageCapsPanel.add(imageTrueVolatile); // Buffer Capabilities JPanel bufferCapsPanel = new JPanel(new BorderLayout()); capsPanel.add(bufferCapsPanel, BorderLayout.CENTER); bufferCapsPanel.setBorder(BorderFactory.createTitledBorder("Buffer Capabilities")); // Buffer Access JPanel bufferAccessCapsPanel = new JPanel(new GridLayout(3, 1)); bufferAccessCapsPanel.setPreferredSize(new Dimension(300, 88)); bufferCapsPanel.add(bufferAccessCapsPanel, BorderLayout.NORTH); // Flipping JPanel flippingPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); bufferAccessCapsPanel.add(flippingPanel); flippingPanel.add(flipping); flipping.setEnabled(false); flippingPanel.add(flippingMethod); // Full-screen JPanel fsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); bufferAccessCapsPanel.add(fsPanel); JPanel indentPanel = new JPanel(); indentPanel.setPreferredSize(new Dimension(30, 30)); fsPanel.add(indentPanel); fsPanel.add(fullScreen); fullScreen.setEnabled(false); // Multi-buffering JPanel mbPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); bufferAccessCapsPanel.add(mbPanel); indentPanel = new JPanel(); indentPanel.setPreferredSize(new Dimension(30, 30)); mbPanel.add(indentPanel); mbPanel.add(multiBuffer); multiBuffer.setEnabled(false); // Front and Back Buffer Capabilities JPanel buffersPanel = new JPanel(new GridLayout(1, 2)); bufferCapsPanel.add(buffersPanel, BorderLayout.CENTER); // Front Buffer JPanel fbPanel = new JPanel(new GridLayout(2, 1)); fbPanel.setBorder(BorderFactory.createTitledBorder("Front Buffer")); buffersPanel.add(fbPanel); fbPanel.add(fbAccelerated); fbAccelerated.setEnabled(false); fbPanel.add(fbTrueVolatile); fbTrueVolatile.setEnabled(false); // Back Buffer JPanel bbPanel = new JPanel(new GridLayout(2, 1)); bbPanel.setPreferredSize(new Dimension(250, 80)); bbPanel.setBorder(BorderFactory.createTitledBorder("Back and Intermediate Buffers")); buffersPanel.add(bbPanel); bbPanel.add(bbAccelerated); bbAccelerated.setEnabled(false); bbPanel.add(bbTrueVolatile); bbTrueVolatile.setEnabled(false); }