use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class AbstractMonPaneTestBase method checkAutoScrollCheckBox.
// Test checking the AutoScroll checkbox.
@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.assertFalse(s.getAutoScrollCheckBoxValue());
s.checkAutoScrollCheckBox();
Assert.assertTrue(s.getAutoScrollCheckBoxValue());
f.setVisible(false);
f.dispose();
}
use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class AbstractMonPaneTestBase method testFreezeButton.
@Test
public void testFreezeButton() throws Exception {
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.assertFalse(s.getFreezeButtonState());
// there is no label on the entryField, so we access that directly.
pane.entryField.setText("foo");
s.clickEnterButton();
s.clickFreezeButton();
Assert.assertTrue(s.getFreezeButtonState());
pane.entryField.setText("bar");
s.clickEnterButton();
JUnitUtil.waitFor(() -> {
return pane.getFrameText().equals("foo\n");
}, "frame text");
Assert.assertEquals("foo\n", pane.getFrameText());
f.dispose();
}
use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class EcosMonPaneTest method checkAutoScrollCheckBox.
// Test checking the AutoScroll checkbox.
// for some reason the EcosMonPane 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();
}
use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class MrcMonPanelTest method checkAutoScrollCheckBox.
// Test checking the AutoScroll checkbox.
// for some reason the MrcMonPanel 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);
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();
}
use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class FileHistoryAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
JFrame frame = new JmriJFrame() {
};
// JmriJFrame to ensure fits on screen
JTextArea pane = new JTextArea();
// add a little space at top
pane.append("\n");
pane.setEditable(false);
JScrollPane scroll = new JScrollPane(pane);
frame.getContentPane().add(scroll);
FileHistory r = InstanceManager.getNullableDefault(FileHistory.class);
if (r == null) {
pane.append("<No History Found>\n");
} else {
pane.append(r.toString());
}
// add a little space at bottom
pane.append("\n");
frame.pack();
// start scrolled to top
JScrollBar b = scroll.getVerticalScrollBar();
b.setValue(b.getMaximum());
// show
frame.setVisible(true);
}
Aggregations