Java Code Examples for javax.swing.BorderFactory#createTitledBorder()
The following examples show how to use
javax.swing.BorderFactory#createTitledBorder() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TemplateParameterEditorDialog.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
private JPanel createParametersPanel() { JPanel paramsPanel = new JPanel(); BoxLayout layout = new BoxLayout(paramsPanel, BoxLayout.PAGE_AXIS); paramsPanel.setLayout(layout); AbstractButton addParamBut = ToolButtonFactory.createButton(UIUtils.loadImageIcon("/org/esa/snap/resources/images/icons/Add16.png"), false); addParamBut.setAlignmentX(Component.LEFT_ALIGNMENT); paramsPanel.add(addParamBut); this.paramsTable = new OperatorParametersTable(this.fakeOperatorDescriptor, appContext); JScrollPane tableScrollPane = new JScrollPane(paramsTable); tableScrollPane.setPreferredSize(new Dimension(500, 130)); tableScrollPane.setAlignmentX(Component.LEFT_ALIGNMENT); paramsPanel.add(tableScrollPane); addParamBut.addActionListener((ActionEvent e) -> paramsTable.addParameterToTable()); TitledBorder title = BorderFactory.createTitledBorder("Template Parameters"); paramsPanel.setBorder(title); return paramsPanel; }
Example 2
Source File: MapBoxTool.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** Creates the ui. */ private void createUI() { groupPanel = new JPanel(); FlowLayout flowLayout = (FlowLayout) groupPanel.getLayout(); flowLayout.setVgap(0); flowLayout.setHgap(0); TitledBorder titledBorder = BorderFactory.createTitledBorder( Localisation.getString(MapBoxTool.class, "MapBoxTool.groupTitle")); groupPanel.setBorder(titledBorder); // Export to SLD exportToSLDButton = new ToolButton( Localisation.getString(MapBoxTool.class, "MapBoxTool.exportToSLD"), "tool/exporttosld.png"); exportToSLDButton.setEnabled(false); exportToSLDButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { exportToSLD(); } }); groupPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT)); groupPanel.add(exportToSLDButton); }
Example 3
Source File: ToolAdapterEditorDialog.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
@Override protected JPanel createDescriptorPanel() { final JPanel descriptorPanel = new JPanel(new SpringLayout()); TextFieldEditor textEditor = new TextFieldEditor(); addValidatedTextField(descriptorPanel, textEditor, Bundle.CTL_Label_Alias_Text(), ToolAdapterConstants.ALIAS, "[^\\\\\\?%\\*:\\|\"<>\\./]*"); addTextField(descriptorPanel, textEditor, Bundle.CTL_Label_UniqueName_Text(), ToolAdapterConstants.NAME, true, null); addTextField(descriptorPanel, textEditor, Bundle.CTL_Label_Label_Text(), ToolAdapterConstants.LABEL, true, null); addTextField(descriptorPanel, textEditor, Bundle.CTL_Label_Version_Text(), ToolAdapterConstants.VERSION, true, null); addTextField(descriptorPanel, textEditor, Bundle.CTL_Label_Copyright_Text(), ToolAdapterConstants.COPYRIGHT, false, null); addTextField(descriptorPanel, textEditor, Bundle.CTL_Label_Authors_Text(), ToolAdapterConstants.AUTHORS, false, null); addTextField(descriptorPanel, textEditor, Bundle.CTL_Label_Description_Text(), ToolAdapterConstants.DESCRIPTION, false, null); java.util.List<String> menus = getAvailableMenuOptions(null); addComboField(descriptorPanel, Bundle.CTL_Label_MenuLocation_Text(), ToolAdapterConstants.MENU_LOCATION, menus); TitledBorder title = BorderFactory.createTitledBorder(Bundle.CTL_Panel_OperatorDescriptor_Text()); descriptorPanel.setBorder(title); SpringUtilities.makeCompactGrid(descriptorPanel, 8, 2, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING); return descriptorPanel; }
Example 4
Source File: ConverterFrame.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public void setProgress(String text, int percent) { Border border = BorderFactory.createTitledBorder(new EmptyBorder(0, 0, 0, 0), "Time remaining: " + text, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Lucida Sans Unicode",Font.PLAIN,12), OFF_WHITE); progressBar.setVisible(true); progressBar.setBorder(border); progressBar.setValue(percent); repaint(); }
Example 5
Source File: Test4243289.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void init() { Font font = new Font("Dialog", Font.PLAIN, 12); // NON-NLS: the font name TitledBorder border = BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Panel Title", // NON-NLS: the title of the border TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, font); JPanel panel = new JPanel(); panel.setBorder(border); getContentPane().add(panel); }
Example 6
Source File: UIRes.java From RipplePower with Apache License 2.0 | 5 votes |
public static void addStyle(JTextArea textArea, String labelName, boolean isBorder) { Border border = null; if (isBorder) { Border line = BorderFactory.createLineBorder(Color.LIGHT_GRAY); TitledBorder titled = BorderFactory.createTitledBorder(line, labelName); titled.setTitleFont(GraphicsUtils.getFont("Verdana", 0, 13)); titled.setTitleColor(fontColorTitle); } textArea.setBorder(border); textArea.setForeground(fontColor); textArea.setFont(GraphicsUtils.getFont("Monospaced", 0, 13)); }
Example 7
Source File: Test4243289.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void init() { Font font = new Font("Dialog", Font.PLAIN, 12); // NON-NLS: the font name TitledBorder border = BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Panel Title", // NON-NLS: the title of the border TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, font); JPanel panel = new JPanel(); panel.setBorder(border); getContentPane().add(panel); }
Example 8
Source File: Test4243289.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void init() { Font font = new Font("Dialog", Font.PLAIN, 12); // NON-NLS: the font name TitledBorder border = BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Panel Title", // NON-NLS: the title of the border TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, font); JPanel panel = new JPanel(); panel.setBorder(border); getContentPane().add(panel); }
Example 9
Source File: Test4243289.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void init() { Font font = new Font("Dialog", Font.PLAIN, 12); // NON-NLS: the font name TitledBorder border = BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Panel Title", // NON-NLS: the title of the border TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, font); JPanel panel = new JPanel(); panel.setBorder(border); getContentPane().add(panel); }
Example 10
Source File: AJTextArea.java From egdownloader with GNU General Public License v2.0 | 5 votes |
/** * 默认使用带标题的边框(实线) * @param borderTitle */ public AJTextArea(String borderTitle, Color borderColor){ this.setAutoscrolls(true); Border border1 = BorderFactory.createLineBorder(borderColor); Border border = BorderFactory.createTitledBorder(border1, borderTitle); this.setBorder(border); // 下面这行代码是自动滚动的关键代码 this.setLineWrap(true); popup(this); }
Example 11
Source File: Test4243289.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void init() { Font font = new Font("Dialog", Font.PLAIN, 12); // NON-NLS: the font name TitledBorder border = BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Panel Title", // NON-NLS: the title of the border TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, font); JPanel panel = new JPanel(); panel.setBorder(border); getContentPane().add(panel); }
Example 12
Source File: Test4243289.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void init() { Font font = new Font("Dialog", Font.PLAIN, 12); // NON-NLS: the font name TitledBorder border = BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Panel Title", // NON-NLS: the title of the border TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, font); JPanel panel = new JPanel(); panel.setBorder(border); getContentPane().add(panel); }
Example 13
Source File: UIUtils.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
public static Border createGroupBorder(String title) { return BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), title); }
Example 14
Source File: JCMInfo.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 4 votes |
static Border makeBorder(JComponent comp, String title) { return BorderFactory.createTitledBorder(title); }
Example 15
Source File: LaboratoryTabPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void initializeUI() { uiDone = true; Lab lab = rover.getLab(); // Prepare laboratory panel WebPanel laboratoryPanel = new WebPanel(new BorderLayout()); topContentPanel.add(laboratoryPanel); // Prepare name panel WebPanel titlePanel = new WebPanel(); laboratoryPanel.add(titlePanel, BorderLayout.NORTH); // Prepare laboratory label WebLabel titleLabel = new WebLabel("Laboratory", WebLabel.CENTER); titleLabel.setFont(new Font("Serif", Font.BOLD, 16)); titlePanel.add(titleLabel); // Prepare the top panel using spring layout. WebPanel springPanel = new WebPanel(new SpringLayout()); // springPanel.setPadding(10, 0, 0, 0); laboratoryPanel.add(springPanel, BorderLayout.CENTER); // Prepare label panel // WebPanel labelPanel = new WebPanel(new GridLayout(3, 1)); // laboratoryPanel.add(labelPanel, BorderLayout.CENTER); // Prepare researcher number label WebLabel headerLabel0 = new WebLabel("Number of Researchers : ", WebLabel.CENTER); springPanel.add(headerLabel0); researchersCache = lab.getResearcherNum(); researchersLabel = new WebLabel("" + researchersCache, WebLabel.CENTER); springPanel.add(researchersLabel); // Prepare researcher capacityLabel WebLabel headerLabel1 = new WebLabel("Researcher Capacity : ", WebLabel.CENTER); springPanel.add(headerLabel1); WebLabel researcherCapacityLabel = new WebLabel("" + lab.getLaboratorySize(), WebLabel.CENTER); springPanel.add(researcherCapacityLabel); // Lay out the spring panel. SpringUtilities.makeCompactGrid(springPanel, 2, 2, //rows, cols 90, 10, //initX, initY 10, 4); //xPad, yPad // Get the research specialties of the building. ScienceType[] specialties = lab.getTechSpecialties(); int size = specialties.length; // Prepare specialty text area WebTextArea specialtyTA = new WebTextArea(); specialtyTA.setEditable(false); specialtyTA.setFont(new Font("SansSerif", Font.ITALIC, 12)); specialtyTA.setColumns(10); // specialtyTA.setSize(100, 60); specialtyTA.setBorder(new MarsPanelBorder()); WebPanel listPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); listPanel.setSize(150, 80); listPanel.add(specialtyTA); TitledBorder titledBorder = BorderFactory.createTitledBorder(null, "Specialties", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new Font("Serif", Font.BOLD, 14), java.awt.Color.darkGray); listPanel.setBorder(titledBorder); // Prepare specialties label // WebLabel specialtiesLabel = new WebLabel("Specialties : ", WebLabel.CENTER); // listPanel.add(specialtiesLabel, BorderLayout.NORTH); laboratoryPanel.add(listPanel, BorderLayout.SOUTH); // For each specialty, add specialty name panel. for (ScienceType specialty : specialties) { specialtyTA.append(" " + specialty.getName()+ " "); if (!specialty.equals(specialties[size-1])) //if it's NOT the last one specialtyTA.append("\n"); } }
Example 16
Source File: MethodsGeneralPane.java From ApkToolPlus with Apache License 2.0 | 4 votes |
protected void setupComponent() { addButton = new JButton("Add method"); dropdown = new JComboBox(); name = new JTextField(15); descriptor = new JTextField(15); JLabel dropdownLabel = new JLabel("Access"); JPanel dropdownPanel = new JPanel(new GridLayout(2,1)); dropdownPanel.add(dropdownLabel); dropdown.addItem(""); dropdown.addItem("public"); dropdown.addItem("private"); dropdown.addItem("protected"); dropdownPanel.add(dropdown); add(dropdownPanel); JPanel checkBoxPanel = new JPanel(); checkBoxPanel.setLayout(new GridLayout(3, 2)); staticCB = new JCheckBox("Static"); finalCB = new JCheckBox("Final"); synchronizedCB = new JCheckBox("Synchronized"); nativeCB = new JCheckBox("Native"); abstractCB = new JCheckBox("Abstract"); strictCB = new JCheckBox("Strict"); checkBoxPanel.add(staticCB); checkBoxPanel.add(finalCB); checkBoxPanel.add(synchronizedCB); checkBoxPanel.add(nativeCB); checkBoxPanel.add(abstractCB); checkBoxPanel.add(strictCB); add(checkBoxPanel); JPanel namePanel = new JPanel(); namePanel.setLayout(new GridLayout(2, 1)); namePanel.add(new JLabel("Name (e.g. main)")); namePanel.add(name); add(namePanel); JPanel descriptionPanel = new JPanel(); descriptionPanel.setLayout(new GridLayout(2, 1)); descriptionPanel.add(new JLabel("Descriptor (e.g. ([Ljava/lang/String;)V)")); descriptionPanel.add(descriptor); add(descriptionPanel); JPanel buttonPanel = new JPanel(new GridLayout(2,1)); buttonPanel.add(new JLabel("")); buttonPanel .add(addButton); add(buttonPanel); Border simpleBorder = BorderFactory.createEtchedBorder(); Border border = BorderFactory.createTitledBorder(simpleBorder, "Add method"); this.setBorder(border); dropdown.addActionListener(this); dropdown.setActionCommand("select"); addButton.addActionListener(this); addButton.setActionCommand("add"); }
Example 17
Source File: FieldsGeneralPane.java From ApkToolPlus with Apache License 2.0 | 4 votes |
protected void setupComponent() { addButton = new JButton("Add field"); dropdown = new JComboBox(); name = new JTextField(15); descriptor = new JTextField(15); dropdown.addItem(""); dropdown.addItem("public"); dropdown.addItem("private"); dropdown.addItem("protected"); JLabel dropdownLabel = new JLabel("Access"); JPanel dropdownPanel = new JPanel(new GridLayout(2,1)); dropdownPanel.add(dropdownLabel); dropdownPanel.add(dropdown); add(dropdownPanel); JPanel checkBoxPanel = new JPanel(); checkBoxPanel.setLayout(new GridLayout(2, 2)); staticCB = new JCheckBox("Static"); finalCB = new JCheckBox("Final"); volatileCB = new JCheckBox("Volatile"); transientCB = new JCheckBox("Transient"); checkBoxPanel.add(staticCB); checkBoxPanel.add(finalCB); checkBoxPanel.add(volatileCB); checkBoxPanel.add(transientCB); add(checkBoxPanel); JPanel namePanel = new JPanel(); namePanel.setLayout(new GridLayout(2, 1)); namePanel.add(new JLabel("Name (e.g. myField)")); namePanel.add(name); add(namePanel); JPanel descriptionPanel = new JPanel(); descriptionPanel.setLayout(new GridLayout(2, 1)); descriptionPanel.add(new JLabel("Descriptor (e.g. Ljava/lang/String;)")); descriptionPanel.add(descriptor); add(descriptionPanel); Border simpleBorder = BorderFactory.createEtchedBorder(); Border border = BorderFactory.createTitledBorder(simpleBorder, "Add field"); this.setBorder(border); JPanel buttonPanel = new JPanel(new GridLayout(2,1)); buttonPanel.add(new JLabel("")); buttonPanel .add(addButton); add(buttonPanel); dropdown.addActionListener(this); dropdown.setActionCommand("select"); addButton.addActionListener(this); addButton.setActionCommand("add"); }
Example 18
Source File: ConstantAddPane.java From ApkToolPlus with Apache License 2.0 | 4 votes |
protected void setupComponent() { addButton = new JButton("Add Constant"); dropdown = new JComboBox(); mainText = new JTextField(15); sndText = new JTextField(15); thirdText = new JTextField(15); mainTextLabel = new JLabel(); sndTextLabel = new JLabel(); thirdTextLabel = new JLabel(); buttonLabel = new JLabel(); dropdownLabel = new JLabel("Constant type"); dropdown.addItem("Class"); dropdown.addItem("Method"); dropdown.addItem("Interface Method"); dropdown.addItem("Field reference"); dropdown.addItem("Float"); dropdown.addItem("Double"); dropdown.addItem("Integer"); dropdown.addItem("Long"); dropdown.addItem("String"); dropdown.addItem("Name and type"); dropdown.addItem("utf8"); JPanel dropdownPanel = new JPanel(); dropdownPanel.setLayout(new GridLayout(2, 1)); dropdownPanel.add(dropdownLabel); dropdownPanel.add(dropdown); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new GridLayout(2, 1)); mainPanel.add(mainTextLabel); mainPanel.add(mainText); JPanel sndPanel = new JPanel(); sndPanel.setLayout(new GridLayout(2, 1)); sndPanel.add(sndTextLabel); sndPanel.add(sndText); JPanel thirdPanel = new JPanel(); thirdPanel.setLayout(new GridLayout(2, 1)); thirdPanel.add(thirdTextLabel); thirdPanel.add(thirdText); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(2, 1)); buttonPanel.add(buttonLabel); buttonPanel.add(addButton); mainTextLabel.setText("Class name"); add(dropdownPanel); add(mainPanel); add(sndPanel); add(thirdPanel); add(buttonPanel); sndText.setEditable(false); thirdText.setEditable(false); Border simpleBorder = BorderFactory.createEtchedBorder(); Border border = BorderFactory.createTitledBorder(simpleBorder, "Add constant"); this.setBorder(border); dropdown.addActionListener(this); dropdown.setActionCommand("select"); addButton.addActionListener(this); addButton.setActionCommand("add"); }
Example 19
Source File: RankingGraph.java From moa with GNU General Public License v3.0 | 4 votes |
private void initComponents() { Container container = getContentPane(); width = getSize().width - 10; height = 70 * getSize().height / 100; graphPanel = new Graph(); zoomPanel = new SliderPanel(); controlPanel = new JPanel(); imgOptionsPanel = new JPanel(); exportPanel = new JPanel(); btnSave = new JButton("Save"); btnLineStroke = new JButton("Line 1 Stroke"); btnFont = new JButton("Text Font"); btnLineDifStronke = new JButton("Line 2 Stroke"); btnDir = new JButton("Save as"); graphPanelDisplay.setLayout(new BorderLayout()); graphPanelDisplay.add(graphPanel, BorderLayout.CENTER); TitledBorder titleborder; titleborder = BorderFactory.createTitledBorder(" Zoom"); zoomPanel.setBorder(titleborder); //titleborder = BorderFactory.createTitledBorder("Options"); //controlPanel.setBorder(titleborder); titleborder = BorderFactory.createTitledBorder("Properties"); imgOptionsPanel.setBorder(titleborder); titleborder = BorderFactory.createTitledBorder("Export"); exportPanel.setBorder(titleborder); graphPanelDisplay.setPreferredSize(new Dimension(width, height)); controlPanel.setPreferredSize(new Dimension(60 * width / 100, 20 * getSize().height / 100)); zoomPanel.setPreferredSize(new Dimension(30 * width / 100, 20 * getSize().height / 100)); EventControl evt = new EventControl(); btnFont.addActionListener(evt); btnLineDifStronke.addActionListener(evt); btnLineStroke.addActionListener(evt); btnSave.addActionListener(evt); btnDir.addActionListener(evt); imgOptionsPanel.add(btnFont); imgOptionsPanel.add(btnLineStroke); imgOptionsPanel.add(btnLineDifStronke); exportPanel.setLayout(new BorderLayout()); JPanel panel = new JPanel(); //panel.add(new JLabel("Export as ")); // panel.add(imgType); // panel.add(btnSave); JPanel panelName = new JPanel(); //panelName.add(new JLabel("File name ")); // panelName.add(JtextFieldimgName); panelName.add(btnDir); exportPanel.add(panelName, BorderLayout.CENTER); exportPanel.add(panel, BorderLayout.SOUTH); controlPanel.setLayout(new BorderLayout()); controlPanel.add(imgOptionsPanel, BorderLayout.CENTER); controlPanel.add(exportPanel, BorderLayout.EAST); controlPanelDisplay.setLayout(new BorderLayout(1, 1)); controlPanelDisplay.add(controlPanel, BorderLayout.CENTER); controlPanelDisplay.add(zoomPanel, BorderLayout.EAST); container.setLayout(new BorderLayout(1, 1)); container.add("Center", graphPanelDisplay); container.add("South", controlPanelDisplay); xScale = 20; yScale = 20; x0 = width / 2; y0 = height / 5; this.availableStrokeSamples = new StrokeSample[4]; this.availableStrokeSamples[0] = new StrokeSample(new BasicStroke(1.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f)); this.availableStrokeSamples[1] = new StrokeSample( new BasicStroke(1.0f)); this.availableStrokeSamples[2] = new StrokeSample( new BasicStroke(2.0f)); this.availableStrokeSamples[3] = new StrokeSample( new BasicStroke(3.0f)); addWindowStateListener((WindowEvent arg0) -> { width = getSize().width - 10; height = 70 * getSize().height / 100; x0 = width / 2; y0 = height / 5; xScale = 20; yScale = 20; xSlider.setValue(50); ySlider.setValue(20); }); }
Example 20
Source File: Utility.java From freecol with GNU General Public License v2.0 | 2 votes |
/** * Get a titled border with Messages.message(key) as text. * * @param key The key to use. * @return The {@code TitledBorder}. */ public static TitledBorder localizedBorder(String key) { return BorderFactory.createTitledBorder(BorderFactory .createEmptyBorder(), Messages.message(key)); }