javax.swing.border.LineBorder Java Examples

The following examples show how to use javax.swing.border.LineBorder. 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: BasicDialog.java    From nanoleaf-desktop with MIT License 6 votes vote down vote up
public BasicDialog()
{
	setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
	setUndecorated(true);
	contentPanel.setLayout(new MigLayout("", "[432.00,grow]", "[][]"));
	contentPanel.setBackground(Color.DARK_GRAY);
	contentPanel.setBorder(new LineBorder(new Color(128, 128, 128), 2));
	setContentPane(contentPanel);
	
	WindowDragListener wdl = new WindowDragListener(50);
	addMouseListener(wdl);
	addMouseMotionListener(wdl);
	
	CloseButton btnClose = new CloseButton(this, JFrame.DISPOSE_ON_CLOSE);
	contentPanel.add(btnClose, "cell 0 0,alignx right,gapx 0 15");
}
 
Example #2
Source File: ContrastMetalTheme.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void addCustomEntriesToTable(UIDefaults table) {

    Border blackLineBorder =
            new BorderUIResource(new LineBorder(getBlack()));
    Border whiteLineBorder =
            new BorderUIResource(new LineBorder(getWhite()));

    Object textBorder = new BorderUIResource(new CompoundBorder(
            blackLineBorder,
            new BasicBorders.MarginBorder()));

    table.put("ToolTip.border", blackLineBorder);
    table.put("TitledBorder.border", blackLineBorder);
    table.put("Table.focusCellHighlightBorder", whiteLineBorder);
    table.put("Table.focusCellForeground", getWhite());

    table.put("TextField.border", textBorder);
    table.put("PasswordField.border", textBorder);
    table.put("TextArea.border", textBorder);
    table.put("TextPane.font", textBorder);


}
 
Example #3
Source File: ProtocolTab.java    From aion-germany with GNU General Public License v3.0 6 votes vote down vote up
public PartRowPanel(PartType type) {
	_type = type;
	_typeCombo = new PartTypeComboBox();
	_typeCombo.setSelectedItem(_type.getName());
	JButton addButton = new JButton(IconsTable.ICON_PLUS);
	addButton.setActionCommand("+id");
	addButton.addActionListener(new PacketEditorActionListener());
	JButton delButton = new JButton(IconsTable.ICON_MINUS);
	delButton.setActionCommand("-id");
	delButton.addActionListener(new PacketEditorActionListener());
	this.add(_typeCombo);
	this.add(addButton);
	this.add(delButton);
	this.setBackground(Color.CYAN);
	this.setBorder(new LineBorder(Color.BLACK));
}
 
Example #4
Source File: CapabilityTableCellEditor.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
@Override
public boolean stopCellEditing() {
   if(current == null) {
      return true;
   }
   try {
      boolean stopped = current.stopCellEditing();
      if(stopped) {
         current = null;
      }
      return stopped;
   }
   catch(Exception e) {
      JComponent c = (JComponent) getComponent();
      c.setBorder(new LineBorder(Color.RED));
      Oculus.warn("Invalid value for cell: " + e.getMessage() + "\nClick 'esc' to stop editing", e);
      return false;
   }
}
 
Example #5
Source File: Main.java    From JavaFX-Tutorial-Codes with Apache License 2.0 6 votes vote down vote up
private void addIcon(MaterialDesign icon) {
    JPanel panel = new JPanel();
    panel.setBackground(Color.decode("#FAFAFA"));
    panel.setBorder(new LineBorder(Color.GRAY));
    panel.setLayout(new GridLayout());
    panel.setSize(300, 300);

    FontIcon fontIcon = FontIcon.of(icon);
    fontIcon.setIconSize(150);
    fontIcon.setIconColor(Color.decode(getRandomColor()));

    JLabel label = new JLabel();
    label.setIcon(fontIcon);
    panel.add(label);
    root.add(panel);
}
 
Example #6
Source File: ContrastMetalTheme.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void addCustomEntriesToTable(UIDefaults table) {

    Border blackLineBorder =
            new BorderUIResource(new LineBorder(getBlack()));
    Border whiteLineBorder =
            new BorderUIResource(new LineBorder(getWhite()));

    Object textBorder = new BorderUIResource(new CompoundBorder(
            blackLineBorder,
            new BasicBorders.MarginBorder()));

    table.put("ToolTip.border", blackLineBorder);
    table.put("TitledBorder.border", blackLineBorder);
    table.put("Table.focusCellHighlightBorder", whiteLineBorder);
    table.put("Table.focusCellForeground", getWhite());

    table.put("TextField.border", textBorder);
    table.put("PasswordField.border", textBorder);
    table.put("TextArea.border", textBorder);
    table.put("TextPane.font", textBorder);


}
 
Example #7
Source File: FcgVertex.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void buildUi() {

		createPaints();

		// init the components
		String truncated = StringUtilities.trimMiddle(getName(), MAX_NAME_LENGTH);
		nameLabel.setText(truncated);
		buildVertexShape();

		// calculate the needed size
		layeredPane = new JLayeredPane();
		Border border = createDebugBorder(new LineBorder(Color.YELLOW.darker(), 1));
		layeredPane.setBorder(border);

		updateLayeredPaneSize();

		// layout the components
		addVertexShape();
		addToggleButtons();
		addNameLabel();

		buildFullShape();
	}
 
Example #8
Source File: TestSinhalaChar.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void run() {
    JFrame frame = new JFrame("Test Character (no crash = PASS)");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    final JLabel label = new JLabel("(empty)");
    label.setSize(400, 100);
    label.setBorder(new LineBorder(Color.black));
    label.setFont(new Font("Lucida Bright", Font.PLAIN, 12));
    if(AUTOMATIC_TEST) {  /* run the test automatically (else, manually) */
       label.setText(Character.toString('\u0DDD'));
    } else {
    JButton button = new JButton("Set Char x0DDD");
    button.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent actionEvent) {
       label.setText(Character.toString('\u0DDD'));
        }
    });
    panel.add(button);
    }
    panel.add(label);

    frame.getContentPane().add(panel);
    frame.pack();
    frame.setVisible(true);
}
 
Example #9
Source File: TestSinhalaChar.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void run() {
    JFrame frame = new JFrame("Test Character (no crash = PASS)");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    final JLabel label = new JLabel("(empty)");
    label.setSize(400, 100);
    label.setBorder(new LineBorder(Color.black));
    label.setFont(new Font("Lucida Bright", Font.PLAIN, 12));
    if(AUTOMATIC_TEST) {  /* run the test automatically (else, manually) */
       label.setText(Character.toString('\u0DDD'));
    } else {
    JButton button = new JButton("Set Char x0DDD");
    button.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent actionEvent) {
       label.setText(Character.toString('\u0DDD'));
        }
    });
    panel.add(button);
    }
    panel.add(label);

    frame.getContentPane().add(panel);
    frame.pack();
    frame.setVisible(true);
}
 
Example #10
Source File: RoomMembersPanel.java    From xyTalk-pc with GNU Affero General Public License v3.0 6 votes vote down vote up
private void initComponents()
{
    setBorder(new LineBorder(Colors.LIGHT_GRAY));
    setBackground(Colors.FONT_WHITE);

    setPreferredSize(new Dimension(ROOM_MEMBER_PANEL_WIDTH, MainFrame.getContext().currentWindowHeight));
    setVisible(false);
    listView.setScrollBarColor(Colors.SCROLL_BAR_THUMB, Colors.WINDOW_BACKGROUND);
    listView.setContentPanelBackground(Colors.FONT_WHITE);
    listView.getContentPanel().setBackground(Colors.FONT_WHITE);

    operationPanel.setPreferredSize(new Dimension(60, 80));
    operationPanel.setBackground(Colors.FONT_WHITE);


    leaveButton = new RCButton("退出群聊", Colors.WINDOW_BACKGROUND_LIGHT, Colors.WINDOW_BACKGROUND, Colors.SCROLL_BAR_TRACK_LIGHT);
    leaveButton.setForeground(Colors.RED);
    leaveButton.setPreferredSize(new Dimension(180, 30));

}
 
Example #11
Source File: PopupFrame.java    From Game with GNU General Public License v3.0 6 votes vote down vote up
private void build() {
	setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	setUndecorated(true);
	setPreferredSize(new Dimension(300, 150));
	setLayout(null);
	setResizable(false);

	getContentPane().setBackground(new Color(30, 30, 30));
	getRootPane().setBorder(new LineBorder(new Color(0, 0, 0), 1));

	msg = new JLabel(message);
	msg.setForeground(Color.WHITE);
	msg.setHorizontalAlignment(0);
	msg.setBounds(0, 45, 300, 25);
	msg.setFont(Utils.getFont("Helvetica.otf", 0, 12.0F));
	add(msg);

	ControlButton close = new ControlButton(3, 110, 100, 75, 25);
	close.setText("Close");
	close.setFocusable(false);
	close.setForeground(Color.WHITE);
	close.addActionListener(arg0 -> setVisible(false));
	add(close);
	addMouseListener();
	pack();
}
 
Example #12
Source File: ContrastMetalTheme.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void addCustomEntriesToTable(UIDefaults table) {

    Border blackLineBorder =
            new BorderUIResource(new LineBorder(getBlack()));
    Border whiteLineBorder =
            new BorderUIResource(new LineBorder(getWhite()));

    Object textBorder = new BorderUIResource(new CompoundBorder(
            blackLineBorder,
            new BasicBorders.MarginBorder()));

    table.put("ToolTip.border", blackLineBorder);
    table.put("TitledBorder.border", blackLineBorder);
    table.put("Table.focusCellHighlightBorder", whiteLineBorder);
    table.put("Table.focusCellForeground", getWhite());

    table.put("TextField.border", textBorder);
    table.put("PasswordField.border", textBorder);
    table.put("TextArea.border", textBorder);
    table.put("TextPane.font", textBorder);


}
 
Example #13
Source File: TestSinhalaChar.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void run() {
    JFrame frame = new JFrame("Test Character (no crash = PASS)");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    final JLabel label = new JLabel("(empty)");
    label.setSize(400, 100);
    label.setBorder(new LineBorder(Color.black));
    label.setFont(new Font("Lucida Bright", Font.PLAIN, 12));
    if(AUTOMATIC_TEST) {  /* run the test automatically (else, manually) */
       label.setText(Character.toString('\u0DDD'));
    } else {
    JButton button = new JButton("Set Char x0DDD");
    button.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent actionEvent) {
       label.setText(Character.toString('\u0DDD'));
        }
    });
    panel.add(button);
    }
    panel.add(label);

    frame.getContentPane().add(panel);
    frame.pack();
    frame.setVisible(true);
}
 
Example #14
Source File: ContrastMetalTheme.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void addCustomEntriesToTable(UIDefaults table) {

    Border blackLineBorder =
            new BorderUIResource(new LineBorder(getBlack()));
    Border whiteLineBorder =
            new BorderUIResource(new LineBorder(getWhite()));

    Object textBorder = new BorderUIResource(new CompoundBorder(
            blackLineBorder,
            new BasicBorders.MarginBorder()));

    table.put("ToolTip.border", blackLineBorder);
    table.put("TitledBorder.border", blackLineBorder);
    table.put("Table.focusCellHighlightBorder", whiteLineBorder);
    table.put("Table.focusCellForeground", getWhite());

    table.put("TextField.border", textBorder);
    table.put("PasswordField.border", textBorder);
    table.put("TextArea.border", textBorder);
    table.put("TextPane.font", textBorder);


}
 
Example #15
Source File: TestSinhalaChar.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void run() {
    JFrame frame = new JFrame("Test Character (no crash = PASS)");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    final JLabel label = new JLabel("(empty)");
    label.setSize(400, 100);
    label.setBorder(new LineBorder(Color.black));
    label.setFont(new Font("Lucida Bright", Font.PLAIN, 12));
    if(AUTOMATIC_TEST) {  /* run the test automatically (else, manually) */
       label.setText(Character.toString('\u0DDD'));
    } else {
    JButton button = new JButton("Set Char x0DDD");
    button.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent actionEvent) {
       label.setText(Character.toString('\u0DDD'));
        }
    });
    panel.add(button);
    }
    panel.add(label);

    frame.getContentPane().add(panel);
    frame.pack();
    frame.setVisible(true);
}
 
Example #16
Source File: Main.java    From nanoleaf-desktop with MIT License 6 votes vote down vote up
private void initWindow() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT);
    if (getUserWindowWidth() != DEFAULT_WINDOW_WIDTH ||
            getUserWindowHeight() != DEFAULT_WINDOW_HEIGHT) {
        setSize(getUserWindowWidth(), getUserWindowHeight());
    }
    setUndecorated(true);
    URL iconPath = getClass().getResource("/images/icon.png");
    ImageIcon imageIcon = new ImageIcon(iconPath);
    Image image = imageIcon.getImage();
    setIconImage(image);

    contentPane = new JPanel();
    contentPane.setBackground(Color.DARK_GRAY);
    contentPane.setBorder(new LineBorder(new Color(128, 128, 128), 3, true));
    setContentPane(contentPane);
    contentPane.setLayout(new MigLayout("", "[-27.00,grow][755.00,grow]",
                                        "[][120px:120px,grow][300px:400px,grow][100px:400px,grow]"));
}
 
Example #17
Source File: SingleEntryDialog.java    From nanoleaf-desktop with MIT License 6 votes vote down vote up
public SingleEntryDialog(Component parent, String entryLabel,
		String buttonLabel, ActionListener buttonListener)
{
	super();
	
	entry = new JTextField(entryLabel);
	entry.setForeground(Color.WHITE);
	entry.setBackground(Color.DARK_GRAY);
	entry.setBorder(new LineBorder(Color.GRAY));
	entry.setCaretColor(Color.WHITE);
	entry.setFont(new Font("Tahoma", Font.PLAIN, 22));
	entry.addFocusListener(new TextFieldFocusListener(entry));
	contentPanel.add(entry, "cell 0 1, grow, gapx 2 2");
	
	JButton btnConfirm = new ModernButton(buttonLabel);
	btnConfirm.setFont(new Font("Tahoma", Font.PLAIN, 18));
	btnConfirm.addActionListener(buttonListener);
	contentPanel.add(btnConfirm, "cell 0 3, alignx center");
	
	JLabel spacer = new JLabel(" ");
	contentPanel.add(spacer, "cell 0 4");
	
	finalize(parent);
	
	btnConfirm.requestFocus();
}
 
Example #18
Source File: FileEditorThumbnail.java    From xyTalk-pc with GNU Affero General Public License v3.0 6 votes vote down vote up
private void initComponents()
{
    setPreferredSize(new Dimension(100, 70));
    setMaximumSize(new Dimension(100, 70));
    setBackground(Colors.FONT_WHITE);
    setBorder(new LineBorder(Colors.LIGHT_GRAY));

    icon = new JLabel();
    icon.setHorizontalAlignment(SwingConstants.CENTER);
    ImageIcon imageIcon = attachmentIconHelper.getImageIcon(path, 35, 35);
    icon.setIcon(imageIcon);


    text = new JLabel();
    text.setFont(FontUtil.getDefaultFont(12));
    text.setText(path.substring(path.lastIndexOf(File.separator) + 1));
    text.setHorizontalAlignment(SwingConstants.CENTER);
}
 
Example #19
Source File: ConfigTable.java    From knife with MIT License 5 votes vote down vote up
public ConfigTable(ConfigTableModel ConfigTableModel)
{
	super(ConfigTableModel);
	this.ConfigTableModel = ConfigTableModel;
	this.setColumnModel(columnModel);
	this.setFillsViewportHeight(true);//在table的空白区域显示右键菜单
	//https://stackoverflow.com/questions/8903040/right-click-mouselistener-on-whole-jtable-component
	this.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
	this.setBorder(new LineBorder(new Color(0, 0, 0)));

	addClickSort();
	registerListeners();
	//switchEnable();//no need 
	//table.setupTypeColumn()//can't set here, only can after table data loaded.
}
 
Example #20
Source File: CompositionArea.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
CompositionArea() {
    // create composition window with localized title
    String windowTitle = Toolkit.getProperty("AWT.CompositionWindowTitle", "Input Window");
    compositionWindow =
        (JFrame)InputMethodContext.createInputMethodWindow(windowTitle, null, true);

    setOpaque(true);
    setBorder(LineBorder.createGrayLineBorder());
    setForeground(Color.black);
    setBackground(Color.white);

    // if we get the focus, we still want to let the client's
    // input context handle the event
    enableInputMethods(true);
    enableEvents(AWTEvent.KEY_EVENT_MASK);

    compositionWindow.getContentPane().add(this);
    compositionWindow.addWindowListener(new FrameWindowAdapter());
    addInputMethodListener(this);
    compositionWindow.enableInputMethods(false);
    compositionWindow.pack();
    Dimension windowSize = compositionWindow.getSize();
    Dimension screenSize = (getToolkit()).getScreenSize();
    compositionWindow.setLocation(screenSize.width - windowSize.width-20,
                                screenSize.height - windowSize.height-100);
    compositionWindow.setVisible(false);
}
 
Example #21
Source File: TestOldHangul.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void run()  {
    Font ourFont = null;
    final String fontName = "UnBatangOdal.ttf";  // download from http://chem.skku.ac.kr/~wkpark/project/font/GSUB/UnbatangOdal/  and place in {user.home}/fonts/
    try {
        ourFont = Font.createFont(Font.TRUETYPE_FONT, new java.io.File(new java.io.File(System.getProperty("user.home"),"fonts"), fontName));
        ourFont = ourFont.deriveFont((float)48.0);
    } catch(Throwable t) {
        t.printStackTrace();
        System.err.println("Fail: " + t);
        return;
    }
    JFrame frame = new JFrame(System.getProperty("java.version"));
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    final JTextArea label = new JTextArea("(empty)");
    label.setSize(400, 300);
    label.setBorder(new LineBorder(Color.black));
    label.setFont(ourFont);
    final String str = "\u110A\u119E\u11B7\u0020\u1112\u119E\u11AB\uAE00\u0020\u1100\u119E\u11F9\u0020\u112B\u119E\u11BC\n";

    if(AUTOMATIC_TEST) {  /* run the test automatically (else, manually) */
        label.setText(str);
    } else {
    JButton button = new JButton("Old Hangul");
    button.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent actionEvent) {
            label.setText(str);
        }
    });
    panel.add(button);
    }
    panel.add(label);

    frame.getContentPane().add(panel);
    frame.pack();
    frame.setVisible(true);
}
 
Example #22
Source File: RightPanel.java    From xyTalk-pc with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initComponents()
{
    cardLayout = new CardLayout();
    contentPanel = new JPanel();
    contentPanel.setLayout(cardLayout);

    titlePanel = new TitlePanel(this);
    chatPanel = new ChatPanel(this);
    roomMembersPanel = new RoomMembersPanel(this);
    tipPanel = new TipPanel(this);
    userInfoPanel = new UserInfoPanel(this);

    setBorder(new LineBorder(Colors.SCROLL_BAR_TRACK_LIGHT));
}
 
Example #23
Source File: TabPreviewControl.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Stes the tab index.
 * 
 * @param tabIndex
 *            Tab index.
 */
public void setTabIndex(int tabIndex) {
    this.iconLabel.setIcon(this.tabPane.getIconAt(tabIndex));
    this.titleLabel.setText(this.tabPane.getTitleAt(tabIndex));
    final boolean isSelected = (this.tabPane.getSelectedIndex() == tabIndex);
    Border innerBorder = isSelected ? new LineBorder(Color.black, 2)
            : new LineBorder(Color.black, 1);
    this.setBorder(new CompoundBorder(new ShadowPopupBorder(), innerBorder));
}
 
Example #24
Source File: CompositionArea.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
CompositionArea() {
    // create composition window with localized title
    String windowTitle = Toolkit.getProperty("AWT.CompositionWindowTitle", "Input Window");
    compositionWindow =
        (JFrame)InputMethodContext.createInputMethodWindow(windowTitle, null, true);

    setOpaque(true);
    setBorder(LineBorder.createGrayLineBorder());
    setForeground(Color.black);
    setBackground(Color.white);

    // if we get the focus, we still want to let the client's
    // input context handle the event
    enableInputMethods(true);
    enableEvents(AWTEvent.KEY_EVENT_MASK);

    compositionWindow.getContentPane().add(this);
    compositionWindow.addWindowListener(new FrameWindowAdapter());
    addInputMethodListener(this);
    compositionWindow.enableInputMethods(false);
    compositionWindow.pack();
    Dimension windowSize = compositionWindow.getSize();
    Dimension screenSize = (getToolkit()).getScreenSize();
    compositionWindow.setLocation(screenSize.width - windowSize.width-20,
                                screenSize.height - windowSize.height-100);
    compositionWindow.setVisible(false);
}
 
Example #25
Source File: AnimationPanel.java    From views-widgets-samples with Apache License 2.0 5 votes vote down vote up
AnimationPanel(CycleSetModel cycleModel, JButton play) {
  super(new FlowLayout(FlowLayout.LEFT));
  setBackground(new Color(0xF8F8F4));
  setBorder(new  LineBorder(new Color(0x888888),1));
  myCycleModel = cycleModel;
  myPlayButton = play;
  myPlayButton.addActionListener(e -> play());
}
 
Example #26
Source File: TestOldHangul.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void run()  {
    Font ourFont = null;
    final String fontName = "UnBatangOdal.ttf";  // download from http://chem.skku.ac.kr/~wkpark/project/font/GSUB/UnbatangOdal/  and place in {user.home}/fonts/
    try {
        ourFont = Font.createFont(Font.TRUETYPE_FONT, new java.io.File(new java.io.File(System.getProperty("user.home"),"fonts"), fontName));
        ourFont = ourFont.deriveFont((float)48.0);
    } catch(Throwable t) {
        t.printStackTrace();
        System.err.println("Fail: " + t);
        return;
    }
    JFrame frame = new JFrame(System.getProperty("java.version"));
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    final JTextArea label = new JTextArea("(empty)");
    label.setSize(400, 300);
    label.setBorder(new LineBorder(Color.black));
    label.setFont(ourFont);
    final String str = "\u110A\u119E\u11B7\u0020\u1112\u119E\u11AB\uAE00\u0020\u1100\u119E\u11F9\u0020\u112B\u119E\u11BC\n";

    if(AUTOMATIC_TEST) {  /* run the test automatically (else, manually) */
        label.setText(str);
    } else {
    JButton button = new JButton("Old Hangul");
    button.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent actionEvent) {
            label.setText(str);
        }
    });
    panel.add(button);
    }
    panel.add(label);

    frame.getContentPane().add(panel);
    frame.pack();
    frame.setVisible(true);
}
 
Example #27
Source File: TabPreviewControl.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Creates a tab preview control.
 * 
 * @param tabPane
 *            Tabbed pane.
 * @param tabIndex
 *            Tab index.
 */
public TabPreviewControl(final JTabbedPane tabPane, final int tabIndex) {
    this.tabPane = tabPane;
    this.setLayout(new TabPreviewControlLayout());
    this.iconLabel = new JLabel(tabPane.getIconAt(tabIndex));
    this.titleLabel = new JLabel(tabPane.getTitleAt(tabIndex));
    this.titleLabel.setFont(this.titleLabel.getFont().deriveFont(Font.BOLD));

    // the panel with the preview image - perhaps use JLabel
    // instead?
    this.previewImagePanel = new JPanel() {
        @Override
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            paintTabThumbnail(g);
        }
    };
    this.add(this.iconLabel);
    this.add(this.titleLabel);
    this.add(this.previewImagePanel);

    final boolean isSelected = (tabPane.getSelectedIndex() == tabIndex);
    Border innerBorder = isSelected ? new LineBorder(Color.black, 2)
            : new LineBorder(Color.black, 1);
    this.setBorder(new CompoundBorder(new ShadowPopupBorder(), innerBorder));

    this.alpha = 0.0f;
    this.zoom = 1.0f;
}
 
Example #28
Source File: ModernTextField.java    From nanoleaf-desktop with MIT License 5 votes vote down vote up
private void init()
{
	setForeground(Color.WHITE);
	setBackground(Color.DARK_GRAY);
	setBorder(new LineBorder(Color.GRAY));
	setCaretColor(Color.WHITE);
	setFont(new Font("Tahoma", Font.PLAIN, 22));
}
 
Example #29
Source File: DiscoveryCellRenderer.java    From nanoleaf-desktop with MIT License 5 votes vote down vote up
public DiscoveryCellRenderer()
{
	setOpaque(true);
	setBorder(new CompoundBorder(
			new LineBorder(java.awt.Color.GRAY, 1),
			new EmptyBorder(0, 0, 10, 0)));
	setVerticalTextPosition(JLabel.BOTTOM);
	setHorizontalTextPosition(JLabel.CENTER);
	setIconTextGap(10);
	setFont(new Font("Tahoma", Font.PLAIN, 22));
	setForeground(java.awt.Color.WHITE);
}
 
Example #30
Source File: Main.java    From nanoleaf-desktop with MIT License 5 votes vote down vote up
private void initPanelCanvas() {
    canvas = new PanelCanvas(devices);
    canvas.setLayout(new GridBagLayout());
    canvas.setBorder(new TitledBorder(new LineBorder(Color.GRAY),
                                      "Preview", TitledBorder.LEFT, TitledBorder.TOP, null, Color.WHITE));
    ((javax.swing.border.TitledBorder) canvas.getBorder())
            .setTitleFont(new Font("Tahoma", Font.BOLD, 22));
    contentPane.add(canvas, "cell 1 1 1 2,grow");
}