下面列出了怎么用java.awt.Dialog.ModalExclusionType的API类实例代码及写法,或者点击链接到github查看源代码。
public void loadReport(String reportName, ReportObject reportObject) {
logging = LoggingEngine.getInstance();
try {
final InputStream inputStream = ShowReport.class
.getResourceAsStream("/com/coder/hms/reportTemplates/" + reportName + ".jrxml");
JasperReport report = JasperCompileManager.compileReport(inputStream);
HashMap<String, Object> parameters = new HashMap<String, Object>();
List<ReportObject> list = new ArrayList<ReportObject>();
list.add(reportObject);
JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(list);
JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, beanColDataSource);
final JRViewer viewer = new JRViewer(jasperPrint);
setType(Type.POPUP);
setResizable(false);
setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
this.setTitle("Reservation [Report]");
this.setExtendedState(Frame.MAXIMIZED_BOTH);
this.setAlwaysOnTop(isAlwaysOnTopSupported());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
this.setIconImage(Toolkit.getDefaultToolkit().
getImage(LoginWindow.class.getResource(LOGOPATH)));
this.setResizable(false);
getContentPane().add(viewer, BorderLayout.CENTER);
} catch (JRException e) {
logging.setMessage("JRException report error!");
}
}
@Override
public boolean isModalExclusionTypeSupported(
ModalExclusionType modalExclusionType) {
return localToolKit.isModalExclusionTypeSupported(modalExclusionType);
}
@Override
public boolean isModalExclusionTypeSupported(ModalExclusionType modalExclusionType) {
throw new UnsupportedOperationException("Not supported yet.");
}
public DialogFrame() {
setType(Type.POPUP);
setResizable(false);
setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
this.setTitle("Approving question");
this.setPreferredSize(new Dimension(400, 190));
this.setAlwaysOnTop(isAlwaysOnTopSupported());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation(screenSize.width / 2 - 150, screenSize.height / 2 - 75);
this.setIconImage(Toolkit.getDefaultToolkit().
getImage(getClass().getResource(LOGOPATH)));
final JPanel panel = new JPanel();
panel.setAutoscrolls(true);
getContentPane().add(panel, BorderLayout.CENTER);
panel.setLayout(null);
btnYes = new JButton("YES");
btnYes.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
btnYes.setBounds(291, 129, 91, 29);
panel.add(btnYes);
btnNo = new JButton("NO");
btnNo.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
btnNo.setBounds(199, 129, 91, 29);
panel.add(btnNo);
lblIcon = new JLabel("");
lblIcon.setIcon(new ImageIcon(DialogFrame.class.getResource("/com/coder/hms/icons/dialogPane_question.png")));
lblIcon.setBounds(14, 40, 69, 70);
panel.add(lblIcon);
textArea = new JTextArea();
textArea.setDisabledTextColor(new Color(153, 204, 255));
textArea.setBounds(95, 32, 287, 85);
textArea.setBackground(UIManager.getColor("ComboBox.background"));
textArea.setBorder(null);
textArea.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
textArea.setEditable(false);
textArea.setFont(new Font("Monospaced", Font.PLAIN, 14));
textArea.setLineWrap(true);
panel.add(textArea);
this.pack();
}
public InformationFrame() {
setType(Type.POPUP);
setResizable(false);
setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
this.setTitle("Approving question");
this.setPreferredSize(new Dimension(350, 170));
this.setAlwaysOnTop(isAlwaysOnTopSupported());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation(screenSize.width / 2 - 150, screenSize.height / 2 - 75);
this.setIconImage(Toolkit.getDefaultToolkit().getImage(InformationFrame.class.getResource(LOGOPATH)));
final JPanel panel = new JPanel();
getContentPane().add(panel, BorderLayout.CENTER);
panel.setLayout(null);
okBtn = new JButton("OK");
okBtn.setIcon(new ImageIcon(InformationFrame.class.getResource("/com/coder/hms/icons/info_ok.png")));
okBtn.setFont(new Font("Lucida Grande", Font.PLAIN, 15));
okBtn.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
okBtn.setBounds(119, 102, 132, 35);
okBtn.addActionListener(getAction());
panel.add(okBtn);
lblMessage = new JLabel("");
lblMessage.setHorizontalTextPosition(SwingConstants.CENTER);
lblMessage.setHorizontalAlignment(SwingConstants.LEFT);
lblMessage.setBounds(87, 21, 246, 74);
panel.add(lblMessage);
lblIcon = new JLabel("");
lblIcon.setIcon(new ImageIcon(InformationFrame.class.getResource("/com/coder/hms/icons/dialogPane_question.png")));
lblIcon.setBounds(6, 36, 69, 70);
panel.add(lblIcon);
this.pack();
}
private void init() {
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
setIconImage(Toolkit.getDefaultToolkit().getImage(ConsoleWindow.class.getResource("/org/citydb/gui/images/common/logo_small.png")));
setLayout(new GridBagLayout());
}
public DatabaseServerPreparingInitializer() {
setType(Type.POPUP);
setResizable(false);
this.setAlwaysOnTop(isAlwaysOnTopSupported());
setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
this.pack();
}