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);
}
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);
}
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);
}
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!");
}
}
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);
}
Aggregations