Search in sources :

Example 21 with JDialog

use of javax.swing.JDialog in project pcgen by PCGen.

the class PCGenFrame method showMatureDialog.

private void showMatureDialog(String text) {
    Logging.errorPrint("Warning: The following datasets contains mature themes. User discretion is advised.");
    Logging.errorPrint(text);
    final JDialog aFrame = new JDialog(this, LanguageBundle.getString("in_matureTitle"), true);
    final JPanel jPanel1 = new JPanel();
    final JPanel jPanel3 = new JPanel();
    final JLabel jLabel1 = new //$NON-NLS-1$
    JLabel(//$NON-NLS-1$
    LanguageBundle.getString("in_matureWarningLine1"), SwingConstants.CENTER);
    final JLabel jLabel2 = new //$NON-NLS-1$
    JLabel(//$NON-NLS-1$
    LanguageBundle.getString("in_matureWarningLine2"), SwingConstants.CENTER);
    //$NON-NLS-1$
    final JCheckBox jCheckBox1 = new JCheckBox(LanguageBundle.getString("in_licShowOnLoad"));
    //$NON-NLS-1$
    final JButton jClose = new JButton(LanguageBundle.getString("in_close"));
    //$NON-NLS-1$
    jClose.setMnemonic(LanguageBundle.getMnemonic("in_mn_close"));
    jPanel1.setLayout(new BorderLayout());
    jPanel1.add(jLabel1, BorderLayout.NORTH);
    jPanel1.add(jLabel2, BorderLayout.SOUTH);
    HtmlPanel htmlPanel = new HtmlPanel();
    HtmlRendererContext theRendererContext = new SimpleHtmlRendererContext(htmlPanel, new SimpleUserAgentContext());
    htmlPanel.setHtml(text, "", theRendererContext);
    jPanel3.add(jCheckBox1);
    jPanel3.add(jClose);
    final PropertyContext context = PCGenSettings.OPTIONS_CONTEXT;
    jCheckBox1.setSelected(context.getBoolean(PCGenSettings.OPTION_SHOW_MATURE_ON_LOAD));
    jClose.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            aFrame.dispose();
        }
    });
    jCheckBox1.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent evt) {
            context.setBoolean(PCGenSettings.OPTION_SHOW_MATURE_ON_LOAD, jCheckBox1.isSelected());
        }
    });
    aFrame.getContentPane().setLayout(new BorderLayout());
    aFrame.getContentPane().add(jPanel1, BorderLayout.NORTH);
    aFrame.getContentPane().add(htmlPanel, BorderLayout.CENTER);
    aFrame.getContentPane().add(jPanel3, BorderLayout.SOUTH);
    aFrame.setSize(new Dimension(456, 176));
    Utility.setComponentRelativeLocation(this, aFrame);
    aFrame.setVisible(true);
}
Also used : SimpleHtmlRendererContext(org.lobobrowser.html.test.SimpleHtmlRendererContext) HtmlRendererContext(org.lobobrowser.html.HtmlRendererContext) SimpleHtmlRendererContext(org.lobobrowser.html.test.SimpleHtmlRendererContext) JPanel(javax.swing.JPanel) ItemEvent(java.awt.event.ItemEvent) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) SimpleUserAgentContext(org.lobobrowser.html.test.SimpleUserAgentContext) Dimension(java.awt.Dimension) JCheckBox(javax.swing.JCheckBox) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) HtmlPanel(org.lobobrowser.html.gui.HtmlPanel) PropertyContext(pcgen.system.PropertyContext) ItemListener(java.awt.event.ItemListener) JDialog(javax.swing.JDialog)

Example 22 with JDialog

use of javax.swing.JDialog in project pcgen by PCGen.

the class PCGenFrame method showLicenseDialog.

private void showLicenseDialog(String title, String htmlString) {
    if (htmlString == null) {
        //$NON-NLS-1$
        htmlString = LanguageBundle.getString("in_licNoInfo");
    }
    final PropertyContext context = PCGenSettings.OPTIONS_CONTEXT;
    final JDialog aFrame = new JDialog(this, title, true);
    //$NON-NLS-1$
    final JButton jClose = new JButton(LanguageBundle.getString("in_close"));
    //$NON-NLS-1$
    jClose.setMnemonic(LanguageBundle.getMnemonic("in_mn_close"));
    final JPanel jPanel = new JPanel();
    //$NON-NLS-1$
    final JCheckBox jCheckBox = new JCheckBox(LanguageBundle.getString("in_licShowOnLoad"));
    jPanel.add(jCheckBox);
    jCheckBox.setSelected(context.getBoolean(PCGenSettings.OPTION_SHOW_LICENSE));
    jCheckBox.addItemListener(evt -> context.setBoolean(PCGenSettings.OPTION_SHOW_LICENSE, jCheckBox.isSelected()));
    jPanel.add(jClose);
    jClose.addActionListener(evt -> aFrame.dispose());
    HtmlPanel htmlPanel = new HtmlPanel();
    HtmlRendererContext theRendererContext = new SimpleHtmlRendererContext(htmlPanel, new SimpleUserAgentContext());
    htmlPanel.setHtml(htmlString, "", theRendererContext);
    aFrame.getContentPane().setLayout(new BorderLayout());
    aFrame.getContentPane().add(htmlPanel, BorderLayout.CENTER);
    aFrame.getContentPane().add(jPanel, BorderLayout.SOUTH);
    aFrame.setSize(new Dimension(700, 500));
    aFrame.setLocationRelativeTo(this);
    Utility.setComponentRelativeLocation(this, aFrame);
    aFrame.getRootPane().setDefaultButton(jClose);
    Utility.installEscapeCloseOperation(aFrame);
    aFrame.setVisible(true);
}
Also used : JCheckBox(javax.swing.JCheckBox) SimpleHtmlRendererContext(org.lobobrowser.html.test.SimpleHtmlRendererContext) HtmlRendererContext(org.lobobrowser.html.HtmlRendererContext) SimpleHtmlRendererContext(org.lobobrowser.html.test.SimpleHtmlRendererContext) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) PropertyContext(pcgen.system.PropertyContext) HtmlPanel(org.lobobrowser.html.gui.HtmlPanel) JButton(javax.swing.JButton) SimpleUserAgentContext(org.lobobrowser.html.test.SimpleUserAgentContext) Dimension(java.awt.Dimension) JDialog(javax.swing.JDialog)

Example 23 with JDialog

use of javax.swing.JDialog in project android_frameworks_base by ResurrectionRemix.

the class UI method showWaitDialog.

public void showWaitDialog() {
    if (currentWaitDialog == null) {
        currentWaitDialog = new JDialog(this, "Please wait...", true);
        currentWaitDialog.getContentPane().add(new JLabel("Please be patient."), BorderLayout.CENTER);
        JProgressBar progress = new JProgressBar(JProgressBar.HORIZONTAL);
        progress.setIndeterminate(true);
        currentWaitDialog.getContentPane().add(progress, BorderLayout.SOUTH);
        currentWaitDialog.setSize(200, 100);
        currentWaitDialog.setLocationRelativeTo(null);
        showWaitDialogLater();
    }
}
Also used : JProgressBar(javax.swing.JProgressBar) JLabel(javax.swing.JLabel) JDialog(javax.swing.JDialog)

Example 24 with JDialog

use of javax.swing.JDialog in project otapij by FellowTraveler.

the class JavaCallback method runOne.

@Override
public void runOne(String szDisplay, OTPassword theOutput) {
    if (null == theOutput) {
        System.out.println("JavaCallback.runOne: Failure: theOutput variable (for password to be returned) is null!");
        return;
    }
    if (!Utility.VerifyStringVal(szDisplay)) {
        System.out.println("JavaCallback.runOne: Failure: strDisplay string (telling you what password to type) is null!");
        return;
    }
    JDialog j = new OTPasswordDialog(null, true, szDisplay);
    j.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    j.setAlwaysOnTop(true);
    j.setVisible(true);
    OTPasswordDialog.getPassword(theOutput);
}
Also used : OTPasswordDialog(com.moneychanger.ui.dialogs.OTPasswordDialog) JDialog(javax.swing.JDialog)

Example 25 with JDialog

use of javax.swing.JDialog in project ACS by ACS-Community.

the class AddToDeployTreeTest method testPortValidation.

public void testPortValidation() throws Exception {
    JDialog dialog;
    AbstractButtonFinder buttonFinder = new AbstractButtonFinder("Add to View");
    // { m_ignoreVisiblity || comp.isShowing() }
    buttonFinder.setIgnoreVisibility(true);
    JButton addButton = (JButton) buttonFinder.find(panel, 0);
    assertNotNull("Could not find the Add button", addButton);
    buttonFinder.setText("Full Refresh");
    JButton refreshButton = (JButton) buttonFinder.find(panel, 0);
    assertNotNull("Could not find the Refresh button", refreshButton);
    ComponentFinder componentFinder = new ComponentFinder(JTextField.class);
    // { m_ignoreVisiblity || comp.isShowing() }
    componentFinder.setIgnoreVisibility(true);
    JTextField hostField = (JTextField) componentFinder.find(panel, 0);
    assertNotNull("Could not find the host field", hostField);
    assertEquals("host field is empty", "", hostField.getText());
    JTextField portField = (JTextField) componentFinder.find(panel, 0);
    assertNotNull("Could not find the port field", portField);
    assertEquals("port field is empty", "", portField.getText());
    getHelper().sendString(new StringEventData(this, hostField, "testhost"));
    getHelper().sendString(new StringEventData(this, portField, "2"));
    getHelper().enterClickAndLeave(new MouseEventData(this, addButton));
    DialogFinder dFinder = new DialogFinder(null);
    dFinder.setWait(2);
    List<Object> showingDialogs = dFinder.findAll();
    assertEquals("Number of dialogs showing is wrong", 1, showingDialogs.size());
    dialog = (JDialog) showingDialogs.get(0);
    assertEquals("Wrong dialog showing up", "Message", dialog.getTitle());
    TestHelper.disposeWindow(dialog, this);
}
Also used : ComponentFinder(junit.extensions.jfcunit.finder.ComponentFinder) StringEventData(junit.extensions.jfcunit.eventdata.StringEventData) AbstractButtonFinder(junit.extensions.jfcunit.finder.AbstractButtonFinder) JButton(javax.swing.JButton) MouseEventData(junit.extensions.jfcunit.eventdata.MouseEventData) JTextField(javax.swing.JTextField) DialogFinder(junit.extensions.jfcunit.finder.DialogFinder) JDialog(javax.swing.JDialog)

Aggregations

JDialog (javax.swing.JDialog)141 JButton (javax.swing.JButton)65 JPanel (javax.swing.JPanel)50 ActionEvent (java.awt.event.ActionEvent)42 JLabel (javax.swing.JLabel)35 ActionListener (java.awt.event.ActionListener)30 BorderLayout (java.awt.BorderLayout)24 JScrollPane (javax.swing.JScrollPane)24 JFrame (javax.swing.JFrame)20 Dimension (java.awt.Dimension)18 BoxLayout (javax.swing.BoxLayout)18 JCheckBox (javax.swing.JCheckBox)15 FlowLayout (java.awt.FlowLayout)14 AbstractAction (javax.swing.AbstractAction)14 JOptionPane (javax.swing.JOptionPane)13 ButtonBarBuilder (com.jgoodies.forms.builder.ButtonBarBuilder)11 WindowEvent (java.awt.event.WindowEvent)11 IOException (java.io.IOException)10 JProgressBar (javax.swing.JProgressBar)10 WindowAdapter (java.awt.event.WindowAdapter)9