Java Code Examples for javax.swing.border.TitledBorder#setTitlePosition()

The following examples show how to use javax.swing.border.TitledBorder#setTitlePosition() . 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: Test4247606.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 2
Source File: Test4247606.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 3
Source File: Test4247606.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 4
Source File: Test4247606.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 5
Source File: Test4247606.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 6
Source File: Test4247606.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 7
Source File: Test4247606.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 8
Source File: Test4247606.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 9
Source File: Test4247606.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 10
Source File: Test4247606.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 11
Source File: Test4247606.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 12
Source File: Test4247606.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 13
Source File: Test4247606.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    JButton button = new JButton("Button"); // NON-NLS: the button text
    button.setBorder(BorderFactory.createLineBorder(Color.red, 1));

    TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
    border.setTitlePosition(TitledBorder.BELOW_BOTTOM);

    JPanel panel = create(button, border);
    panel.setBackground(Color.green);

    getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
 
Example 14
Source File: WizardManager.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void updateScrollPaneBorder(JPanel panel) {
	if (panel == null) {
		return;
	}

	scrollPane.setBackground(panel.getBackground());

	if (scrollPane.getVerticalScrollBar().isShowing()) {
		TitledBorder titledBorder =
			new TitledBorder(BorderFactory.createEmptyBorder(), "(scroll for more options)");

		Font font = titledBorder.getTitleFont();
		if (font == null) {
			// workaround for bug on Java 7
			font = titleLabel.getFont();
		}

		titledBorder.setTitleFont(font.deriveFont(10f));
		titledBorder.setTitleColor(Color.BLUE);
		titledBorder.setTitlePosition(TitledBorder.BOTTOM);
		titledBorder.setTitleJustification(TitledBorder.TRAILING);

		scrollPane.setBorder(titledBorder);
	}
	else {
		scrollPane.setBorder(BorderFactory.createEmptyBorder());
	}
}
 
Example 15
Source File: BorderDemo.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
void addCompForTitledBorder(TitledBorder border, String description, int justification, int position, Container container) {
    border.setTitleJustification(justification);
    border.setTitlePosition(position);
    addCompForBorder(border, description, container);
}
 
Example 16
Source File: GUIOptionPrivateDNS.java    From PacketProxy with Apache License 2.0 4 votes vote down vote up
private JPanel createPanel(JCheckBox checkBox, JTextField text) throws Exception {
	auto = new JRadioButton(I18nString.get("Auto (Replace resolved IP with local IP of suitable NIC automatically)"), true);
	auto.setMinimumSize(new Dimension(Short.MAX_VALUE, auto.getMaximumSize().height));
	auto.addActionListener(this::radioButtonChangeHandler);
	manual = new JRadioButton(I18nString.get("Manual"), false);
	manual.addActionListener(this::radioButtonChangeHandler);

	ButtonGroup rewriteGroup = new ButtonGroup();
	rewriteGroup.add(auto);
	rewriteGroup.add(manual);

	JPanel manualPanel = new JPanel();
	manualPanel.setBackground(Color.WHITE);
	manualPanel.setLayout(new BoxLayout(manualPanel, BoxLayout.X_AXIS));
	manualPanel.add(manual);
	manualPanel.add(text);

	TitledBorder rewriteRuleBorder = new TitledBorder(I18nString.get("Rewrite Rule"));
	LineBorder inborder = new LineBorder(Color.BLACK, 1);
	rewriteRuleBorder.setBorder(inborder);
	rewriteRuleBorder.setTitleFont(FontManager.getInstance().getUIFont());
	rewriteRuleBorder.setTitleJustification(TitledBorder.LEFT);
	rewriteRuleBorder.setTitlePosition(TitledBorder.TOP);

	JPanel rewriteRule = new JPanel();
	rewriteRule.setLayout(new BoxLayout(rewriteRule, BoxLayout.Y_AXIS));
	rewriteRule.setBackground(Color.WHITE);
	rewriteRule.setBorder(rewriteRuleBorder);
	rewriteRule.add(auto);
	rewriteRule.add(manualPanel);
	rewriteRule.setMaximumSize(new Dimension(rewriteRule.getPreferredSize().width, rewriteRule.getMinimumSize().height));

	JPanel panel = new JPanel();
	panel.setBackground(Color.WHITE);
	panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
	panel.add(checkBox);
	panel.add(rewriteRule);
	panel.setAlignmentX(Component.LEFT_ALIGNMENT);

	return panel;
}
 
Example 17
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
private MainPanel() {
  super(new BorderLayout());

  AlignedLabel fileNameLabel = new AlignedLabel("File Name:");
  AlignedLabel filesOfTypeLabel = new AlignedLabel("Files of Type:");
  AlignedLabel hostLabel = new AlignedLabel("Host:");
  AlignedLabel portLabel = new AlignedLabel("Port:");
  AlignedLabel userLabel = new AlignedLabel("User Name:");
  AlignedLabel passwordLabel = new AlignedLabel("Password:");
  AlignedLabel.groupLabels(fileNameLabel, filesOfTypeLabel, hostLabel, portLabel, userLabel, passwordLabel);

  Border innerBorder = BorderFactory.createEmptyBorder(5, 2, 5, 5);

  Box box1 = Box.createVerticalBox();
  TitledBorder border1 = BorderFactory.createTitledBorder("FileChooser");
  border1.setTitlePosition(TitledBorder.ABOVE_TOP);
  box1.setBorder(BorderFactory.createCompoundBorder(border1, innerBorder));
  box1.add(makeLabeledBox(fileNameLabel, new JTextField()));
  box1.add(Box.createVerticalStrut(5));
  box1.add(makeLabeledBox(filesOfTypeLabel, new JComboBox<String>()));

  Box box2 = Box.createVerticalBox();
  TitledBorder border2 = BorderFactory.createTitledBorder("HTTP Proxy");
  border2.setTitlePosition(TitledBorder.ABOVE_TOP);
  box2.setBorder(BorderFactory.createCompoundBorder(border2, innerBorder));
  box2.add(makeLabeledBox(hostLabel, new JTextField()));
  box2.add(Box.createVerticalStrut(5));
  box2.add(makeLabeledBox(portLabel, new JTextField()));
  box2.add(Box.createVerticalStrut(5));
  box2.add(makeLabeledBox(userLabel, new JTextField()));
  box2.add(Box.createVerticalStrut(5));
  box2.add(makeLabeledBox(passwordLabel, new JPasswordField()));

  Box box = Box.createVerticalBox();
  box.add(box1);
  box.add(Box.createVerticalStrut(10));
  box.add(box2);

  add(box, BorderLayout.NORTH);
  setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  setPreferredSize(new Dimension(320, 240));
}