Package javax.swing

Examples of javax.swing.JWindow$AccessibleJWindow


    m_showFileMenu = showFileMenu;

    // end modifications by Zerbetto
    // Grab a fontmetrics object
    JWindow temp = new JWindow();
    temp.setVisible(true);
    temp.getGraphics().setFont(new Font(null, Font.PLAIN, 9));
    m_fontM = temp.getGraphics().getFontMetrics();
    temp.setVisible(false);

    // some GUI defaults
    try {
      m_ScrollBarIncrementLayout = Integer.parseInt(
          BEAN_PROPERTIES.getProperty(
View Full Code Here


  /** This demonstrates how to customize a small <code>ColorPicker</code> component.
   */
  public static void main(String[] args) {
   
    final JFrame demo = new JFrame("Demo");
    final JWindow palette = new JWindow(demo);
    final ColorPicker picker = new ColorPicker(true,false);
   
    final JComboBox comboBox = new JComboBox();
    final JCheckBox alphaCheckbox = new JCheckBox("Include Alpha");
    final JCheckBox hsbCheckbox = new JCheckBox("Include HSB Values");
    final JCheckBox rgbCheckbox = new JCheckBox("Include RGB Values");
    final JCheckBox modeCheckbox = new JCheckBox("Include Mode Controls",true);
    final JButton button = new JButton("Show Dialog");
   
    demo.getContentPane().setLayout(new GridBagLayout());
    palette.getContentPane().setLayout(new GridBagLayout());
   
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 0;
    c.insets = new Insets(5,5,5,5); c.anchor = GridBagConstraints.WEST;
    palette.getContentPane().add(comboBox,c);
    c.gridy++;
    palette.getContentPane().add(alphaCheckbox,c);
    c.gridy++;
    palette.getContentPane().add(hsbCheckbox,c);
    c.gridy++;
    palette.getContentPane().add(rgbCheckbox,c);
    c.gridy++;
    palette.getContentPane().add(modeCheckbox,c);
   
    c.gridy = 0;
    c.weighty = 1; c.fill = GridBagConstraints.BOTH;
    picker.setPreferredSize(new Dimension(220,200));
    demo.getContentPane().add(picker,c);
    c.gridy++; c.weighty = 0;
    demo.getContentPane().add(picker.getExpertControls(),c);
    c.gridy++; c.fill = GridBagConstraints.NONE;
    demo.getContentPane().add(button,c);
   
    comboBox.addItem("Hue");
    comboBox.addItem("Saturation");
    comboBox.addItem("Brightness");
    comboBox.addItem("Red");
    comboBox.addItem("Green");
    comboBox.addItem("Blue");
   
    ActionListener checkboxListener = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Object src = e.getSource();
        if(src==alphaCheckbox) {
          picker.setOpacityVisible(alphaCheckbox.isSelected());
        } else if(src==hsbCheckbox) {
          picker.setHSBControlsVisible(hsbCheckbox.isSelected());
        } else if(src==rgbCheckbox) {
          picker.setRGBControlsVisible(rgbCheckbox.isSelected());
        } else if(src==modeCheckbox) {
          picker.setModeControlsVisible(modeCheckbox.isSelected());
        }
        demo.pack();
      }
    };
    picker.setOpacityVisible(false);
    picker.setHSBControlsVisible(false);
    picker.setRGBControlsVisible(false);
    picker.setHexControlsVisible(false);
    picker.setPreviewSwatchVisible(false);
   
    picker.addPropertyChangeListener(ColorPicker.MODE_PROPERTY, new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent evt) {
        int m = picker.getMode();
        if(m==ColorPicker.HUE) {
          comboBox.setSelectedIndex(0);
        } else if(m==ColorPicker.SAT) {
          comboBox.setSelectedIndex(1);
        } else if(m==ColorPicker.BRI) {
          comboBox.setSelectedIndex(2);
        } else if(m==ColorPicker.RED) {
          comboBox.setSelectedIndex(3);
        } else if(m==ColorPicker.GREEN) {
          comboBox.setSelectedIndex(4);
        } else if(m==ColorPicker.BLUE) {
          comboBox.setSelectedIndex(5);
        }
      }
    });
   
    alphaCheckbox.addActionListener(checkboxListener);
    hsbCheckbox.addActionListener(checkboxListener);
    rgbCheckbox.addActionListener(checkboxListener);
    modeCheckbox.addActionListener(checkboxListener);
    button.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Color color = picker.getColor();
        color = ColorPicker.showDialog(demo, color, true);
        if(color!=null)
          picker.setColor(color);
      }
    });

    comboBox.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        int i = ((JComboBox)e.getSource()).getSelectedIndex();
        if(i==0) {
          picker.setMode(ColorPicker.HUE);
        } else if(i==1) {
          picker.setMode(ColorPicker.SAT);
        } else if(i==2) {
          picker.setMode(ColorPicker.BRI);
        } else if(i==3) {
          picker.setMode(ColorPicker.RED);
        } else if(i==4) {
          picker.setMode(ColorPicker.GREEN);
        } else if(i==5) {
          picker.setMode(ColorPicker.BLUE);
        }
      }
    });
    comboBox.setSelectedIndex(2);

    palette.pack();
    palette.setLocationRelativeTo(null);
   
    demo.addComponentListener(new ComponentAdapter() {
      @Override
      public void componentMoved(ComponentEvent e) {
        Point p = demo.getLocation();
        palette.setLocation(new Point(p.x-palette.getWidth()-10,p.y));
      }
    });
    demo.pack();
    demo.setLocationRelativeTo(null);
    demo.setVisible(true);
    palette.setVisible(true);
   
    demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
View Full Code Here

      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      e.printStackTrace();
    }
   
    JWindow splash = null;
    if (!silentMode) {
      splash = NodeMainUI.showSplash();
    }
   
    try {
      Grid.startGridNode();
    } catch (DiscoveryFailureException ex) {
      log.warn("Discovery Failed");
    } catch (Exception e) {
     
      log.error("Exception while starting",e);
      e.printStackTrace();

      if (!silentMode) {
        splash.setVisible(false);
        JOptionPane.showMessageDialog(null, "Unable to start GridNode due to Exception." +
            "\nSee StackTrace (log) for details", "Nebula Grid", JOptionPane.ERROR_MESSAGE);
      }
     
      System.exit(1);
    }
   
    NodeMainUI ui = NodeMainUI.create();
   

   
    // Show if not Silent Mode
    if (!silentMode) {
      splash.setVisible(false);
      splash.dispose();
      ui.setVisible(true);
    }
   
    log.info("[UI] Initialized");
   
View Full Code Here

    if (m_previewWindow == null) {
     
      JLabel jl = new JLabel(m_subFlowPreview);
      //Dimension d = jl.getPreferredSize();
      jl.setLocation(0,0);
      m_previewWindow = new JWindow();
      //popup.getContentPane().setLayout(null);
      m_previewWindow.getContentPane().add(jl);
      m_previewWindow.validate();
      m_previewWindow.setSize(m_subFlowPreview.getIconWidth(), m_subFlowPreview.getIconHeight());
     
View Full Code Here

            hoverLabel.setEditable(false);
            hoverLabel.setOpaque(false);
            hoverLabel.setBorder(new BevelBorder(BevelBorder.RAISED));
            hoverLabel.setFont(new java.awt.Font("Tahoma", 0, 11));

            hoverWindow = new JWindow();
            hoverWindow.setBackground(gradientColor);
            hoverWindow.add(hoverLabel, BorderLayout.CENTER);
            registerHoverInfo();
        }
        barRowPlotter = new BarRowPlotter(chartSettings, yAxisLabelRenderer);
View Full Code Here

            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            content = frame.getContentPane();
            w = frame;
        } else {
            Frame frame = JOptionPane.getRootFrame();
            JWindow window = new JWindow(frame, gconfig);
            content = window.getContentPane();
            w = window;
        }
        final Window f = w;
        WindowUtils.setWindowTransparent(f, true);
        content.add(new JButton("Quit") {
View Full Code Here

        GraphicsConfiguration gconfig = WindowUtils.getAlphaCompatibleGraphicsConfiguration();
        Frame root = JOptionPane.getRootFrame();
        final Window background = new Window(root);
        background.setBackground(Color.white);
        background.setLocation(X, Y);
        final JWindow transparent = new JWindow(root, gconfig);
        transparent.setLocation(X, Y);
        ((JComponent)transparent.getContentPane()).setOpaque(false);
        transparent.getContentPane().add(new JComponent() {
      private static final long serialVersionUID = 1L;
      public Dimension getPreferredSize() {
                return new Dimension(W, H);
            }
            protected void paintComponent(Graphics g) {
                g = g.create();
                g.setColor(Color.red);
                g.fillRect(getWidth()/4, getHeight()/4, getWidth()/2, getHeight()/2);
                g.drawRect(0, 0, getWidth()-1, getHeight()-1);
                g.dispose();
            }
        });
        transparent.addMouseListener(handler);
        transparent.addMouseMotionListener(handler);
       
        SwingUtilities.invokeAndWait(new Runnable() { public void run() {
            background.pack();
            background.setSize(new Dimension(W, H));
            background.setVisible(true);
            transparent.pack();
            transparent.setSize(new Dimension(W, H));
            transparent.setVisible(true);
            transparent.toFront();
        }});
       
        WindowUtils.setWindowTransparent(transparent, true);
       
        //robot.delay(60000);
View Full Code Here

    // Forcer not required on OSX
    if (Platform.isMac())
      return;

    Frame root = JOptionPane.getRootFrame();
    final JWindow w = new JWindow(root);
    w.getContentPane().add(new JLabel(getName()));
    final Rectangle mask = new Rectangle(0, 0, 10, 10);
    SwingUtilities.invokeAndWait(new Runnable() {
      public void run() {
        w.pack();
        WindowUtils.setWindowMask(w, mask);
        w.setVisible(true);
      }
    });
    try {
      Window[] owned = w.getOwnedWindows();
      WeakReference<Window> ref = null;
      for (int i = 0; i < owned.length; i++) {
        if (owned[i].getClass().getName().indexOf("Heavy") != -1) {
          ref = new WeakReference<Window>(owned[i]);
          break;
        }
      }
      owned = null;
      assertNotNull("Forcer not found", ref);
      SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
          WindowUtils.setWindowMask(w, WindowUtils.MASK_NONE);
        }
      });
      System.gc();
      long start = System.currentTimeMillis();
      while (ref.get() != null) {
        Thread.sleep(10);
        System.gc();
        if (System.currentTimeMillis() - start > 5000)
          fail("Timed out waiting for forcer to be GC'd");
      }
      assertNull("Forcer not GC'd", ref.get());
    } finally {
      w.dispose();
    }
  }
View Full Code Here

  }

  public static void progressImage() throws IOException, InterruptedException {
    URL url = new URL(progressImageUrl);
    java.awt.Image image = Toolkit.getDefaultToolkit().createImage(url);
    JWindow window = SwingHelper.getProgressWheelWindow(new ImageIcon(image));
    window.setVisible(true);
    Thread.sleep(3000);
    window.setVisible(false);
  }
View Full Code Here

 
  private void initGUI() {
    try {
      setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
      {
        jWindow1 = new JWindow();
        getContentPane().add(getJWindow1(), BorderLayout.CENTER);
        {
          jFrame1 = new JFrame();
          jWindow1.getContentPane().add(getJFrame1(), BorderLayout.CENTER);
        }
View Full Code Here

TOP

Related Classes of javax.swing.JWindow$AccessibleJWindow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.