Search in sources :

Example 91 with BorderLayout

use of java.awt.BorderLayout in project nhin-d by DirectProject.

the class CertPolicyValidator method initUI.

private void initUI() {
    getContentPane().setLayout(new BorderLayout());
    validate = new ValidatePanel();
    getContentPane().add(validate);
}
Also used : BorderLayout(java.awt.BorderLayout)

Example 92 with BorderLayout

use of java.awt.BorderLayout in project nhin-d by DirectProject.

the class ValidatePanel method initUI.

protected void initUI() {
    setLayout(new BorderLayout());
    setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new EmptyBorder(5, 5, 5, 5)));
    // File Load Fields
    policyFileField = new FileField("Policy Definition File:", "");
    certFileField = new FileField("Certificate File: ", "");
    final JPanel filePanel = new JPanel(new GridLayout(1, 2));
    filePanel.add(certFileField);
    filePanel.add(policyFileField);
    this.add(filePanel, BorderLayout.NORTH);
    // Report panel
    final JLabel reportHeaderLabel = new JLabel("Validation Report");
    reportText = new JTextArea();
    reportText.setLineWrap(true);
    reportText.setWrapStyleWord(true);
    reportText.setEditable(false);
    final JScrollPane scrollPane = new JScrollPane(reportText);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    final JPanel reportPanel = new JPanel(new BorderLayout());
    reportPanel.add(reportHeaderLabel, BorderLayout.NORTH);
    reportPanel.add(scrollPane, BorderLayout.CENTER);
    this.add(reportPanel, BorderLayout.CENTER);
    // Button Panel
    cmdValidate = new JButton("Validate");
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.add(cmdValidate);
    this.add(buttonPanel, BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) JTextArea(javax.swing.JTextArea) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) JButton(javax.swing.JButton) SoftBevelBorder(javax.swing.border.SoftBevelBorder) JLabel(javax.swing.JLabel) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder)

Example 93 with BorderLayout

use of java.awt.BorderLayout in project nhin-d by DirectProject.

the class EditorPanel method initUI.

protected void initUI() {
    setLayout(new BorderLayout());
    setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new EmptyBorder(5, 5, 5, 5)));
    policyText = new JTextArea();
    policyText.setLineWrap(true);
    policyText.setWrapStyleWord(true);
    policyText.setEditable(true);
    final JScrollPane scrollPane = new JScrollPane(policyText);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
    fileNameLabel = new JLabel("*New File*");
    final JPanel reportPanel = new JPanel(new BorderLayout());
    reportPanel.add(fileNameLabel, BorderLayout.NORTH);
    reportPanel.add(scrollPane, BorderLayout.CENTER);
    //this.add(reportPanel, BorderLayout.CENTER);
    validatePanel = new ValidatePanel();
    validatePanel.setFeedMode(PolicyLexicon.SIMPLE_TEXT_V1, policyText.getDocument());
    final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, reportPanel, validatePanel);
    splitPane.setDividerLocation(400);
    this.add(splitPane, BorderLayout.CENTER);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTextArea(javax.swing.JTextArea) ValidatePanel(org.nhindirect.policy.tools.policyvalidate.ValidatePanel) BorderLayout(java.awt.BorderLayout) SoftBevelBorder(javax.swing.border.SoftBevelBorder) JLabel(javax.swing.JLabel) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) JSplitPane(javax.swing.JSplitPane)

Example 94 with BorderLayout

use of java.awt.BorderLayout in project jdk8u_jdk by JetBrains.

the class HiDPIRobotScreenCaptureTest method main.

public static void main(String[] args) throws Exception {
    try {
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Exception e) {
        return;
    }
    Frame frame = new Frame();
    frame.setBounds(40, 30, 400, 300);
    frame.setUndecorated(true);
    Panel panel = new Panel(new BorderLayout());
    Canvas canvas = new Canvas() {

        @Override
        public void paint(Graphics g) {
            super.paint(g);
            int w = getWidth();
            int h = getHeight();
            g.setColor(COLORS[0]);
            g.fillRect(0, 0, w / 2, h / 2);
            g.setColor(COLORS[1]);
            g.fillRect(w / 2, 0, w / 2, h / 2);
            g.setColor(COLORS[2]);
            g.fillRect(0, h / 2, w / 2, h / 2);
            g.setColor(COLORS[3]);
            g.fillRect(w / 2, h / 2, w / 2, h / 2);
        }
    };
    panel.add(canvas);
    frame.add(panel);
    frame.setVisible(true);
    Robot robot = new Robot();
    robot.waitForIdle();
    Thread.sleep(200);
    Rectangle rect = canvas.getBounds();
    rect.setLocation(canvas.getLocationOnScreen());
    BufferedImage image = robot.createScreenCapture(rect);
    frame.dispose();
    int w = image.getWidth();
    int h = image.getHeight();
    if (w != frame.getWidth() || h != frame.getHeight()) {
        throw new RuntimeException("Wrong image size!");
    }
    if (image.getRGB(w / 4, h / 4) != COLORS[0].getRGB()) {
        throw new RuntimeException("Wrong image color!");
    }
    if (image.getRGB(3 * w / 4, h / 4) != COLORS[1].getRGB()) {
        throw new RuntimeException("Wrong image color!");
    }
    if (image.getRGB(w / 4, 3 * h / 4) != COLORS[2].getRGB()) {
        throw new RuntimeException("Wrong image color!");
    }
    if (image.getRGB(3 * w / 4, 3 * h / 4) != COLORS[3].getRGB()) {
        throw new RuntimeException("Wrong image color!");
    }
}
Also used : Graphics(java.awt.Graphics) Panel(java.awt.Panel) Frame(java.awt.Frame) BorderLayout(java.awt.BorderLayout) Canvas(java.awt.Canvas) Rectangle(java.awt.Rectangle) Robot(java.awt.Robot) BufferedImage(java.awt.image.BufferedImage)

Example 95 with BorderLayout

use of java.awt.BorderLayout in project jdk8u_jdk by JetBrains.

the class SelectionVisible method init.

@Override
public void init() {
    tf = new TextField(20);
    tf.setText("0123456789");
    tf.select(0, 6);
    final TextArea ta = new TextArea("INSTRUCTIONS:\n" + "The text 012345 should be selected in the TextField.\n" + "If this is what you observe, then the test passes.\n" + "Otherwise, the test fails.", 40, 5, TextArea.SCROLLBARS_NONE);
    ta.setEditable(false);
    ta.setPreferredSize(new Dimension(300, 70));
    final Panel panel = new Panel();
    panel.setLayout(new FlowLayout());
    panel.add(tf);
    setLayout(new BorderLayout());
    add(ta, BorderLayout.CENTER);
    add(panel, BorderLayout.PAGE_END);
}
Also used : Panel(java.awt.Panel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) TextArea(java.awt.TextArea) TextField(java.awt.TextField) Dimension(java.awt.Dimension)

Aggregations

BorderLayout (java.awt.BorderLayout)761 JPanel (javax.swing.JPanel)514 JLabel (javax.swing.JLabel)238 JScrollPane (javax.swing.JScrollPane)191 Dimension (java.awt.Dimension)155 JButton (javax.swing.JButton)134 FlowLayout (java.awt.FlowLayout)90 ActionEvent (java.awt.event.ActionEvent)88 JTextField (javax.swing.JTextField)85 EmptyBorder (javax.swing.border.EmptyBorder)73 ActionListener (java.awt.event.ActionListener)70 JCheckBox (javax.swing.JCheckBox)69 Insets (java.awt.Insets)64 BoxLayout (javax.swing.BoxLayout)62 GridBagConstraints (java.awt.GridBagConstraints)57 GridBagLayout (java.awt.GridBagLayout)57 JTable (javax.swing.JTable)57 JTextArea (javax.swing.JTextArea)52 GridLayout (java.awt.GridLayout)49 Box (javax.swing.Box)45