void jbInit() throws Exception {
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
// Create the component to display the banner text
text = new JTextArea();
text.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
// text.setLineWrap(true);
text.setEditable(false);
Font f = new Font("MonoSpaced", text.getFont().getStyle(),
text.getFont().getSize());
text.setFont(f);
JScrollPane textScroller = new JScrollPane(text);
// Create the center banner panel
IconWrapperPanel centerPanel = new IconWrapperPanel(new ResourceIcon(
BannerDialog.class, BANNER_ICON), textScroller);
centerPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
// Create the south button panel
JButton ok = new JButton("Ok");
ok.setMnemonic('o");
ok.setDefaultCapable(true);
ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
// I presume this component is not reused?
dispose();
}
});
JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
southPanel.add(ok);
getRootPane().setDefaultButton(ok);
// Build the main panel
getContentPane().setLayout(new BorderLayout());
getContentPane().add(centerPanel, BorderLayout.CENTER);
getContentPane().add(southPanel, BorderLayout.SOUTH);
//
setSize(500, 245);
setResizable(false);
}
|