javax.swing.border.TitledBorder#setTitlePosition ( )源码实例Demo

下面列出了javax.swing.border.TitledBorder#setTitlePosition ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: Test4247606.java
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)));
}
 
源代码2 项目: ghidra   文件: WizardManager.java
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());
	}
}
 
源代码3 项目: TencentKona-8   文件: Test4247606.java
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)));
}
 
源代码4 项目: jdk8u60   文件: Test4247606.java
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)));
}
 
源代码5 项目: openjdk-jdk8u   文件: Test4247606.java
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)));
}
 
源代码6 项目: openjdk-jdk8u-backup   文件: Test4247606.java
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)));
}
 
源代码7 项目: openjdk-jdk9   文件: Test4247606.java
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)));
}
 
源代码8 项目: jdk8u-jdk   文件: Test4247606.java
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)));
}
 
源代码9 项目: hottub   文件: Test4247606.java
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)));
}
 
源代码10 项目: openjdk-8-source   文件: Test4247606.java
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)));
}
 
源代码11 项目: openjdk-8   文件: Test4247606.java
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)));
}
 
源代码12 项目: jdk8u_jdk   文件: Test4247606.java
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)));
}
 
源代码13 项目: jdk8u-jdk   文件: Test4247606.java
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)));
}
 
源代码14 项目: jdk8u-dev-jdk   文件: Test4247606.java
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)));
}
 
源代码15 项目: PacketProxy   文件: GUIOptionPrivateDNS.java
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;
}
 
源代码16 项目: marathonv5   文件: BorderDemo.java
void addCompForTitledBorder(TitledBorder border, String description, int justification, int position, Container container) {
    border.setTitleJustification(justification);
    border.setTitlePosition(position);
    addCompForBorder(border, description, container);
}
 
源代码17 项目: java-swing-tips   文件: MainPanel.java
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));
}