public void actionPerformed(ActionEvent e){ AboutDialog dlg = new AboutDialog(JSVGViewerFrame.this); // Work around pack() bug on some platforms dlg.setSize(dlg.getPreferredSize()); dlg.setLocationRelativeTo(JSVGViewerFrame.this); dlg.setVisible(true); dlg.toFront(); } }
/** * Creates a new AboutDialog with a given owner. */ public AboutDialog(Frame owner) { super(owner); buildGUI(); addKeyListener(new KeyAdapter(){ public void keyPressed(KeyEvent e){ if(e.getKeyCode() == KeyEvent.VK_ESCAPE){ setVisible(false); dispose(); } } }); addMouseListener(new MouseAdapter(){ public void mousePressed(MouseEvent e){ setVisible(false); dispose(); } }); }
public void mousePressed(MouseEvent e){ setVisible(false); dispose(); } });
JSVGViewerFrame relativeTo = (JSVGViewerFrame) viewerFrames.get(0); AboutDialog dlg = new AboutDialog(relativeTo); final AboutDialog initDialog = new AboutDialog(); ((BorderLayout) initDialog.getContentPane().getLayout()).setVgap(8); final JProgressBar pb = new JProgressBar(0, 3); initDialog.getContentPane().add(pb, BorderLayout.SOUTH); Dimension ss = initDialog.getToolkit().getScreenSize(); Dimension ds = initDialog.getPreferredSize(); initDialog.setLocation((ss.width - ds.width) / 2, (ss.height - ds.height) / 2); initDialog.setSize(ds); initDialog.setVisible(true);
public void setLocationRelativeTo(Frame f) { Dimension invokerSize = f.getSize(); Point loc = f.getLocation(); Point invokerScreenLocation = new Point(loc.x, loc.y); Rectangle bounds = getBounds(); int dx = invokerScreenLocation.x+((invokerSize.width-bounds.width)/2); int dy = invokerScreenLocation.y+((invokerSize.height - bounds.height)/2); Dimension screenSize = getToolkit().getScreenSize(); if (dy+bounds.height>screenSize.height) { dy = screenSize.height-bounds.height; dx = invokerScreenLocation.x<(screenSize.width>>1) ? invokerScreenLocation.x+invokerSize.width : invokerScreenLocation.x-bounds.width; } if (dx+bounds.width>screenSize.width) { dx = screenSize.width-bounds.width; } if (dx<0) dx = 0; if (dy<0) dy = 0; setLocation(dx, dy); }
/** * Creates a new AboutDialog. */ public AboutDialog() { buildGUI(); }
public void gvtRenderingCompleted(GVTTreeRendererEvent e) { initDialog.dispose(); v.dispose(); System.gc(); run(); } });
getContentPane().setBackground(Color.white); getContentPane().add(p); p.add(l2, Integer.valueOf(2)); ((JComponent)getContentPane()).setBorder (BorderFactory.createCompoundBorder (BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.gray, Color.black),
JSVGViewerFrame relativeTo = (JSVGViewerFrame) viewerFrames.get(0); AboutDialog dlg = new AboutDialog(relativeTo); final AboutDialog initDialog = new AboutDialog(); ((BorderLayout) initDialog.getContentPane().getLayout()).setVgap(8); final JProgressBar pb = new JProgressBar(0, 3); initDialog.getContentPane().add(pb, BorderLayout.SOUTH); Dimension ss = initDialog.getToolkit().getScreenSize(); Dimension ds = initDialog.getPreferredSize(); initDialog.setLocation((ss.width - ds.width) / 2, (ss.height - ds.height) / 2); initDialog.setSize(ds); initDialog.setVisible(true);
public void setLocationRelativeTo(Frame f) { Dimension invokerSize = f.getSize(); Point loc = f.getLocation(); Point invokerScreenLocation = new Point(loc.x, loc.y); Rectangle bounds = getBounds(); int dx = invokerScreenLocation.x+((invokerSize.width-bounds.width)/2); int dy = invokerScreenLocation.y+((invokerSize.height - bounds.height)/2); Dimension screenSize = getToolkit().getScreenSize(); if (dy+bounds.height>screenSize.height) { dy = screenSize.height-bounds.height; dx = invokerScreenLocation.x<(screenSize.width>>1) ? invokerScreenLocation.x+invokerSize.width : invokerScreenLocation.x-bounds.width; } if (dx+bounds.width>screenSize.width) { dx = screenSize.width-bounds.width; } if (dx<0) dx = 0; if (dy<0) dy = 0; setLocation(dx, dy); }
/** * Creates a new AboutDialog. */ public AboutDialog() { buildGUI(); }
public void gvtRenderingCompleted(GVTTreeRendererEvent e) { initDialog.dispose(); v.dispose(); System.gc(); run(); } });
getContentPane().setBackground(Color.white); getContentPane().add(p); p.add(l2, new Integer(2)); ((JComponent)getContentPane()).setBorder (BorderFactory.createCompoundBorder (BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.gray, Color.black),
public void actionPerformed(ActionEvent e){ AboutDialog dlg = new AboutDialog(JSVGViewerFrame.this); // Work around pack() bug on some platforms dlg.setSize(dlg.getPreferredSize()); dlg.setLocationRelativeTo(JSVGViewerFrame.this); dlg.setVisible(true); dlg.toFront(); } }
/** * Creates a new AboutDialog with a given owner. */ public AboutDialog(Frame owner) { super(owner); buildGUI(); addKeyListener(new KeyAdapter(){ public void keyPressed(KeyEvent e){ if(e.getKeyCode() == KeyEvent.VK_ESCAPE){ setVisible(false); dispose(); } } }); addMouseListener(new MouseAdapter(){ public void mousePressed(MouseEvent e){ setVisible(false); dispose(); } }); }
public void mousePressed(MouseEvent e){ setVisible(false); dispose(); } });
public Object invoke(Object proxy, Method method, Object[] args) { String name = method.getName(); if (name.equals("handleAbout")) { JSVGViewerFrame relativeTo = (JSVGViewerFrame) viewerFrames.get(0); AboutDialog dlg = new AboutDialog(relativeTo); // Work around pack() bug on some platforms dlg.setSize(dlg.getPreferredSize()); dlg.setLocationRelativeTo(relativeTo); dlg.setVisible(true); dlg.toFront(); } else if (name.equals("handlePreferences")) { JSVGViewerFrame relativeTo = (JSVGViewerFrame) viewerFrames.get(0); showPreferenceDialog(relativeTo); } else if (name.equals("handleQuit")) { // Do nothing, let the OS quit the app. } else { return null; } try { setHandled.invoke(args[0], new Object[] { Boolean.TRUE }); } catch (Exception e) { } return null; } };
public void keyPressed(KeyEvent e){ if(e.getKeyCode() == KeyEvent.VK_ESCAPE){ setVisible(false); dispose(); } } });
public Object invoke(Object proxy, Method method, Object[] args) { String name = method.getName(); if (name.equals("handleAbout")) { JSVGViewerFrame relativeTo = (JSVGViewerFrame) viewerFrames.get(0); AboutDialog dlg = new AboutDialog(relativeTo); // Work around pack() bug on some platforms dlg.setSize(dlg.getPreferredSize()); dlg.setLocationRelativeTo(relativeTo); dlg.setVisible(true); dlg.toFront(); } else if (name.equals("handlePreferences")) { JSVGViewerFrame relativeTo = (JSVGViewerFrame) viewerFrames.get(0); showPreferenceDialog(relativeTo); } else if (name.equals("handleQuit")) { // Do nothing, let the OS quit the app. } else { return null; } try { setHandled.invoke(args[0], new Object[] { Boolean.TRUE }); } catch (Exception e) { } return null; } };
public void keyPressed(KeyEvent e){ if(e.getKeyCode() == KeyEvent.VK_ESCAPE){ setVisible(false); dispose(); } } });