From: gmungoc Date: Tue, 5 Feb 2019 13:51:22 +0000 (+0000) Subject: Test (passes!) for dialog message truncation X-Git-Tag: Release_2_11_4_0~45^2~18^2~247 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=859fa94ec04c88e4e499e153efd2ce2188c2fc34;p=jalview.git Test (passes!) for dialog message truncation --- diff --git a/utils/test/JalviewJSTest.java b/utils/test/JalviewJSTest.java index 0d4d708..d81e392 100644 --- a/utils/test/JalviewJSTest.java +++ b/utils/test/JalviewJSTest.java @@ -1,4 +1,8 @@ package test; +import jalview.gui.Desktop; +import jalview.gui.JvOptionPane; +import jalview.util.MessageManager; + import java.awt.BorderLayout; import java.awt.ComponentOrientation; import java.awt.Container; @@ -36,7 +40,30 @@ public class JalviewJSTest extends JPanel { public static void main(String[] args) { - new JalviewJSTest().doTest4(); + new JalviewJSTest().doTest5(); + } + + /** + * Dialog message truncation + */ + void doTest5() + { + JFrame main = new JFrame(); + main.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + main.setContentPane(new JPanel()); + main.setMinimumSize(new Dimension(100, 100)); + main.pack(); + main.setVisible(true); + + /* + * like AlignFrame.delete_actionPerformed() + * except here it works fine, also in JS + */ + JvOptionPane dialog = JvOptionPane.newOptionDialog(null); + Object[] options = new Object[] { "OK", "Cancel" }; + String msg = "Deleting all sequences will close the alignment window.
Confirm deletion or Cancel."; + dialog.showDialog(msg, "", JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null, options, options[0]); + } void doTest4() @@ -67,10 +94,11 @@ public class JalviewJSTest extends JPanel System.out.println("f2 hashCode = " + f2.hashCode()); System.out.println(map.get(f2)); } + /** * Put some content in a JFrame and show it */ - void doTest() + void doTest1() { System.out.println("ab;c;".split(";")); new DecimalFormat("###,###").format((Integer) 1);