Search in sources :

Example 46 with JmriJFrame

use of jmri.util.JmriJFrame in project JMRI by JMRI.

the class AbstractMonPaneTestBase method checkOnTopCheckBox.

// Test checking the Always On Top checkbox.
@Test
public void checkOnTopCheckBox() {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    AbstractMonPaneScaffold s = new AbstractMonPaneScaffold(pane);
    // for Jemmy to work, we need the pane inside of a frame
    JmriJFrame f = new JmriJFrame();
    try {
        pane.initComponents();
    } catch (Exception ex) {
        Assert.fail("Could not load pane: " + ex);
    }
    f.add(pane);
    // set title if available
    if (pane.getTitle() != null) {
        f.setTitle(pane.getTitle());
    }
    f.pack();
    f.setVisible(true);
    s.checkOnTopCheckBox();
    Assert.assertTrue(s.getOnTopCheckBoxValue());
    f.dispose();
}
Also used : JmriJFrame(jmri.util.JmriJFrame) Test(org.junit.Test)

Example 47 with JmriJFrame

use of jmri.util.JmriJFrame in project JMRI by JMRI.

the class AbstractMonPaneTestBase method checkTimeStampCheckBox.

// Test checking the Time Stamp checkbox.
@Test
public void checkTimeStampCheckBox() {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    AbstractMonPaneScaffold s = new AbstractMonPaneScaffold(pane);
    // for Jemmy to work, we need the pane inside of a frame
    JmriJFrame f = new JmriJFrame();
    try {
        pane.initComponents();
    } catch (Exception ex) {
        Assert.fail("Could not load pane: " + ex);
    }
    f.add(pane);
    // set title if available
    if (pane.getTitle() != null) {
        f.setTitle(pane.getTitle());
    }
    f.pack();
    f.setVisible(true);
    s.checkTimeStampCheckBox();
    Assert.assertTrue(s.getTimeStampCheckBoxValue());
    f.dispose();
}
Also used : JmriJFrame(jmri.util.JmriJFrame) Test(org.junit.Test)

Example 48 with JmriJFrame

use of jmri.util.JmriJFrame in project JMRI by JMRI.

the class AffineEntryPanelTest method testListener.

@Test
public void testListener() {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    JmriJFrame f = new JmriJFrame();
    AffineEntryPanel p = new AffineEntryPanel();
    f.add(p);
    f.pack();
    f.setTitle("Test RPS Listener");
    f.setVisible(true);
    java.beans.PropertyChangeListener l = new java.beans.PropertyChangeListener() {

        @Override
        public void propertyChange(java.beans.PropertyChangeEvent e) {
            if (e.getPropertyName().equals("value")) {
                System.out.println("See " + e.getPropertyName() + " as " + e.getNewValue());
            }
        }
    };
    p.addPropertyChangeListener(l);
    JFrame f2 = jmri.util.JmriJFrame.getFrame("Test RPS Listener");
    Assert.assertNotNull("found frame", f2);
    f2.dispose();
}
Also used : JmriJFrame(jmri.util.JmriJFrame) JmriJFrame(jmri.util.JmriJFrame) JFrame(javax.swing.JFrame) Test(org.junit.Test)

Example 49 with JmriJFrame

use of jmri.util.JmriJFrame in project JMRI by JMRI.

the class LocoMonPaneTest method checkAutoScrollCheckBox.

// Test checking the AutoScroll checkbox.
// for some reason the LocoMonPane has the checkbox value reversed on
// startup compared to other AbstractMonPane derivatives.
@Override
@Test
public void checkAutoScrollCheckBox() {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    AbstractMonPaneScaffold s = new AbstractMonPaneScaffold(pane);
    // for Jemmy to work, we need the pane inside of a frame
    JmriJFrame f = new JmriJFrame();
    try {
        pane.initComponents();
    } catch (Exception ex) {
        Assert.fail("Could not load pane: " + ex);
    }
    f.add(pane);
    // set title if available
    if (pane.getTitle() != null) {
        f.setTitle(pane.getTitle());
    }
    f.pack();
    f.setVisible(true);
    Assert.assertTrue(s.getAutoScrollCheckBoxValue());
    s.checkAutoScrollCheckBox();
    Assert.assertFalse(s.getAutoScrollCheckBoxValue());
    f.setVisible(false);
    f.dispose();
}
Also used : JmriJFrame(jmri.util.JmriJFrame) AbstractMonPaneScaffold(jmri.jmrix.AbstractMonPaneScaffold) Test(org.junit.Test)

Example 50 with JmriJFrame

use of jmri.util.JmriJFrame in project JMRI by JMRI.

the class LocoStatsFrameTest method getFrame.

LocoStatsPanel getFrame(String title, int offset) throws Exception {
    JmriJFrame f = new JmriJFrame();
    LocoStatsPanel p = new LocoStatsPanel() {

        @Override
        public void requestUpdate() {
            // replace actual transmit
            updateRequestPending = true;
        }
    };
    p.initComponents();
    f.getContentPane().add(p);
    f.setTitle(title);
    f.setLocation(0, offset);
    f.pack();
    f.setVisible(true);
    return p;
}
Also used : JmriJFrame(jmri.util.JmriJFrame) LocoStatsPanel(jmri.jmrix.loconet.locostats.swing.LocoStatsPanel)

Aggregations

JmriJFrame (jmri.util.JmriJFrame)111 ActionEvent (java.awt.event.ActionEvent)46 BoxLayout (javax.swing.BoxLayout)44 JPanel (javax.swing.JPanel)44 JButton (javax.swing.JButton)38 ActionListener (java.awt.event.ActionListener)33 FlowLayout (java.awt.FlowLayout)30 JLabel (javax.swing.JLabel)30 Test (org.junit.Test)22 Container (java.awt.Container)20 JScrollPane (javax.swing.JScrollPane)20 JFrame (javax.swing.JFrame)16 JSeparator (javax.swing.JSeparator)10 JTable (javax.swing.JTable)10 JComboBox (javax.swing.JComboBox)9 TableColumn (javax.swing.table.TableColumn)9 TableColumnModel (javax.swing.table.TableColumnModel)9 ButtonGroup (javax.swing.ButtonGroup)8 JCheckBox (javax.swing.JCheckBox)8 JMenuBar (javax.swing.JMenuBar)8