X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=src%2Fjavajs%2Fswing%2FJDialog.java;fp=src%2Fjavajs%2Fswing%2FJDialog.java;h=17202145c5f0f8fa2ae8043947018dae83f965de;hp=355e6022e558dda37b6d3255eb0ba05f5ba26473;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/src/javajs/swing/JDialog.java b/src/javajs/swing/JDialog.java index 355e602..1720214 100644 --- a/src/javajs/swing/JDialog.java +++ b/src/javajs/swing/JDialog.java @@ -1,126 +1,126 @@ -package javajs.swing; - -import javajs.awt.Color; -import javajs.awt.Container; -import javajs.util.SB; - - -/** - * There is really no need here for awt.Dialog. - * We would not use FileDialog in an HTML5 context anyway. - * - */ -public class JDialog extends Container { - - private static final int headerHeight = 25; - private int defaultWidth = 600; - private int defaultHeight = 300; - - private JContentPane contentPane; - private String title; - private String html; - private int zIndex = 9000; - - public void setZIndex(int zIndex) { - this.zIndex = zIndex; - } - - int[] loc; - - public JDialog() { - super("JD"); - add(contentPane = new JContentPane()); - setBackground(Color.get3(210, 210, 240)); - contentPane.setBackground(Color.get3(230, 230, 230)); - } - - public void setLocation(int[] loc) { - this.loc = loc; - } - - public JContentPane getContentPane() { - return contentPane; - } - - public void setTitle(String title) { - this.title = title; - } - - public void pack() { - html = null; - } - - public void validate() { - html = null; - } - - @Override - public void setVisible(boolean tf) { - if (tf && html == null) - setDialog(); - super.setVisible(tf); - } - - public void dispose() { - { - - /** - * @j2sNative - * - * SwingController.dispose(this); - * - */ - { - } - - } - } - - @Override - public void repaint() { - setDialog(); - } - - /** - * Set it into DOM, but don't show it yet. - * this.loc, this.manager, this.id, etc. - * - */ - private void setDialog() { - html = toHTML(); - /** - * @j2sNative - * - * SwingController.setDialog(this); - * - * - */ - { - System.out.println(html); - } - } - - @Override - public String toHTML() { - renderWidth = getSubcomponentWidth(); - if (renderWidth == 0) - renderWidth = defaultWidth; - renderHeight = contentPane.getSubcomponentHeight(); - if (renderHeight == 0) - renderHeight = defaultHeight; - int h = renderHeight - headerHeight; - SB sb = new SB(); - sb.append("\n