forked from jasder/antlr
Use JFrame instead of JDialog to get "expand window" buttons
This commit is contained in:
parent
37ff8a3161
commit
d580f2184f
|
@ -285,8 +285,8 @@ public class TreeViewer extends JComponent {
|
|||
private static final String DIALOG_DIVIDER_LOC_PREFS_KEY = "dialog_divider_location";
|
||||
private static final String DIALOG_VIEWER_SCALE_PREFS_KEY = "dialog_viewer_scale";
|
||||
|
||||
protected static JDialog showInDialog(final TreeViewer viewer) {
|
||||
final JDialog dialog = new JDialog();
|
||||
protected static JFrame showInDialog(final TreeViewer viewer) {
|
||||
final JFrame dialog = new JFrame();
|
||||
dialog.setTitle("Parse Tree Inspector");
|
||||
|
||||
final Preferences prefs = Preferences.userNodeForPackage(TreeViewer.class);
|
||||
|
@ -431,7 +431,7 @@ public class TreeViewer extends JComponent {
|
|||
return dialog;
|
||||
}
|
||||
|
||||
private static void generatePNGFile(TreeViewer viewer, JDialog dialog) {
|
||||
private static void generatePNGFile(TreeViewer viewer, JFrame dialog) {
|
||||
BufferedImage bi = new BufferedImage(viewer.getSize().width,
|
||||
viewer.getSize().height,
|
||||
BufferedImage.TYPE_INT_ARGB);
|
||||
|
@ -536,14 +536,14 @@ public class TreeViewer extends JComponent {
|
|||
}
|
||||
|
||||
|
||||
public Future<JDialog> open() {
|
||||
public Future<JFrame> open() {
|
||||
final TreeViewer viewer = this;
|
||||
viewer.setScale(1.5);
|
||||
Callable<JDialog> callable = new Callable<JDialog>() {
|
||||
JDialog result;
|
||||
Callable<JFrame> callable = new Callable<JFrame>() {
|
||||
JFrame result;
|
||||
|
||||
@Override
|
||||
public JDialog call() throws Exception {
|
||||
public JFrame call() throws Exception {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -566,7 +566,7 @@ public class TreeViewer extends JComponent {
|
|||
}
|
||||
|
||||
public void save(String fileName) throws IOException, PrintException {
|
||||
JDialog dialog = new JDialog();
|
||||
JFrame dialog = new JFrame();
|
||||
Container contentPane = dialog.getContentPane();
|
||||
((JComponent) contentPane).setBorder(BorderFactory.createEmptyBorder(
|
||||
10, 10, 10, 10));
|
||||
|
|
|
@ -15,13 +15,13 @@ import java.util.concurrent.Future;
|
|||
|
||||
public class Trees {
|
||||
/** Call this method to view a parse tree in a dialog box visually. */
|
||||
public static Future<JDialog> inspect(Tree t, List<String> ruleNames) {
|
||||
public static Future<JFrame> inspect(Tree t, List<String> ruleNames) {
|
||||
TreeViewer viewer = new TreeViewer(ruleNames, t);
|
||||
return viewer.open();
|
||||
}
|
||||
|
||||
/** Call this method to view a parse tree in a dialog box visually. */
|
||||
public static Future<JDialog> inspect(Tree t, Parser parser) {
|
||||
public static Future<JFrame> inspect(Tree t, Parser parser) {
|
||||
List<String> ruleNames = parser != null ? Arrays.asList(parser.getRuleNames()) : null;
|
||||
return inspect(t, ruleNames);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue