Пример #1
0
 public void setDemo(String demo) {
   setTitle("Jogl Demo: " + demo);
   if (animator == null) {
     animator = new Animator();
     animator.setIgnoreExceptions(true);
   }
   // stop();
   if (drawable != null) {
     gradientPanel.remove(drawable);
     animator.remove(drawable);
     drawable = null;
   }
   if (demo.equals("gears")) {
     drawable = new JGears();
     type = GEARS;
   }
   // else if(demo.equals("graphics")){
   //    type=GRAPHICS;
   //   drawable=new JGLGraphics();
   // }
   if (drawable != null) {
     gradientPanel.add(drawable, BorderLayout.CENTER);
     animator.add(drawable);
   }
 }
Пример #2
0
  public JPanel makeFileTable() {
    JPanel right = new JPanel();
    right.setLayout(new BorderLayout());
    right.setOpaque(true);
    // right.setBackground( Color.white );

    JTreeTableAdmin treeTable = new JTreeTableAdmin(new FileSystemModelAdmin());
    right.add(new JScrollPane(treeTable), BorderLayout.CENTER);

    return right;
  }
Пример #3
0
 public void propertyChange(PropertyChangeEvent evt) {
   if (DisplayOptions.isUpdateUIEvent(evt)) {
     SwingUtilities.updateComponentTreeUI(this);
     gradientPanel.remove(drawable);
     JPanel newpanel = createGradientPanel();
     contentPane.remove(gradientPanel);
     gradientPanel = newpanel;
     gradientPanel.add(drawable, BorderLayout.CENTER);
     contentPane.add(gradientPanel, BorderLayout.CENTER);
   }
 }
Пример #4
0
  public void setCurrentLayout(int newId) {

    if (newId >= nviews) return;

    tabbedPane.removeAll();
    tabbedToolPanel.removeAll();
    String key;
    String currValue;
    JComponent obj;
    PushpinIF pobj;
    clearPushpinComp();
    for (int i = 0; i < keys.size(); i++) {
      key = (String) keys.get(i);
      currValue = (String) tp_paneInfo[newId].get(key);
      obj = (JComponent) panes.get(key);
      pobj = null;
      if (currValue.equals("yes") && obj != null) {
        if (obj instanceof PushpinIF) {
          pobj = (PushpinIF) obj;
          pobj.setAvailable(true);
          if (!pobj.isOpen()) {
            if (!pobj.isPopup()) obj = null;
          }
        }
        if (obj != null) {
          if (key.equals("Locator")) key = getLocatorName();
          tabbedPane.addTab(key, null, obj, "");
        }
        // tabbedPane.addTab(key, null, (JComponent)panes.get(key), "");
      }
    }

    if (tabbedPane.getTabCount() < 1) {
      pinPanel.setAvailable(false);
      pinPanel.setStatus("close");
      // setVisible(false);
      return;
    }

    pinPanel.setAvailable(true);
    pinPanel.setStatus("open");
    if (tabbedPane.getTabCount() == 1) {
      tabbedToolPanel.add(tabbedPane.getComponentAt(0));
      // tabbedToolPanel.add(tabbedPane);
    } else {
      tabbedToolPanel.add(tabbedPane);
    }
    setSelectedTab(tp_selectedTab, selectedTabName);

    tabbedToolPanel.validate();
    // repaint();
  }
Пример #5
0
    protected void layoutUIComponents(String strPath, boolean bDefaultFile) {
      JLabel label = null;

      // i18n
      // label = new JLabel( "File names can be constructed from a template. The LABEL field is " );
      label =
          new JLabel(
              Util.getAdmLabel(
                  "_admin_File_names_can_be_constructed_from_a_template._The_LABEL_field_is_"));
      label.setForeground(Color.black);
      // m_gbc.weightx = 0.5;
      showInstruction(m_gbl, m_gbc, 0, 0, 7, label);

      // i18n
      // label = new JLabel( "presented as the choice to the user in the \"Data save\" pop-up." );
      label =
          new JLabel(
              Util.getAdmLabel(
                  "_admin_presented_as_the_choice_to_the_user_in_the_Data_save_pop-up."));
      showInstruction(m_gbl, m_gbc, 0, 1, 7, label);
      showInstruction(m_gbl, m_gbc, 0, 2, 1, new JLabel(""));

      label = new JLabel(Util.getAdmLabel("_adm_LABEL"));
      label.setForeground(Color.black);
      m_gbc.gridx = 1;
      m_gbc.gridy = 2;
      m_gbc.ipadx = 10;
      m_gbl.setConstraints(label, m_gbc);
      m_pnlDisplay.add(label);

      label = new JLabel("     ");
      m_gbc.gridx = 2;
      m_gbc.gridy = 2;
      m_gbc.ipadx = 0; // reset to default
      m_gbc.gridwidth = 5;
      m_gbl.setConstraints(label, m_gbc);
      // add( label );

      showInstruction(m_gbl, m_gbc, 2, 2, 1, new JLabel(Util.getAdmLabel("_admin_TEMPLATE")));

      m_nRow = 3;
      m_bDefaultFile = bDefaultFile;
      m_objTxfValue.clearArrays();
      displayNewTxf(strPath);

      m_pnlDisplay.setBorder(
          new CompoundBorder(
              BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
Пример #6
0
  public GLDemo() {
    super(VNMRFrame.getVNMRFrame(), "Jogl Demo", false);

    DisplayOptions.addChangeListener(this);

    contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    gradientPanel = createGradientPanel();

    contentPane.add(gradientPanel, BorderLayout.CENTER);

    checkBox = new JCheckBox("Transparent", true);
    checkBox.setActionCommand("transparancy");
    checkBox.addActionListener(this);
    optionsPan = new JPanel();
    optionsPan.setLayout(new SimpleH2Layout(SimpleH2Layout.LEFT, 5, 0, true, false));
    optionsPan.setBorder(new EtchedBorder(EtchedBorder.LOWERED));

    optionsPan.add(checkBox);

    runButton = new JToggleButton("Run");
    runButton.setActionCommand("run");
    runButton.setSelected(false);
    runButton.addActionListener(this);

    optionsPan.add(runButton);

    getContentPane().add(optionsPan, BorderLayout.SOUTH);
    setSize(300, 300);
    setLocation(300, 300);

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            // Run this on another thread than the AWT event queue to
            // make sure the call to Animator.stop() completes before
            // exiting
            new Thread(
                    new Runnable() {
                      public void run() {
                        stop();
                      }
                    })
                .start();
          }
        });
    setVisible(false);
  }
Пример #7
0
  public static JPanel createGradientPanel() {
    JPanel gradientPanel =
        new JPanel() {
          Color c = Util.getBgColor();

          public void paintComponent(Graphics g) {
            ((Graphics2D) g)
                .setPaint(
                    new GradientPaint(0, 0, c.brighter(), getWidth(), getHeight(), c.darker()));
            g.fillRect(0, 0, getWidth(), getHeight());
          }
        };
    gradientPanel.setLayout(new BorderLayout());
    return gradientPanel;
  }
Пример #8
0
  protected void addComp(JPanel panel, Component comp, GridBagConstraints gbc, int x, int y) {
    gbc.gridx = x;
    gbc.gridy = y;
    gbc.fill = GridBagConstraints.HORIZONTAL;

    panel.add(comp, gbc);
  }
Пример #9
0
 private void showSpaces(GridBagLayout gbl, GridBagConstraints gbc, int gridx, int gridy) {
   JLabel spaces = new JLabel("     ");
   gbc.gridx = gridx;
   gbc.gridy = gridy;
   gbl.setConstraints(spaces, gbc);
   m_pnlDisplay.add(spaces);
 }
Пример #10
0
  public int getOpenCount() {
    int num = tabbedToolPanel.getComponentCount();
    if (num != 1) return num;
    Component comp = tabbedToolPanel.getComponent(0);
    if (comp instanceof JTabbedPane) {
      JTabbedPane tp = (JTabbedPane) comp;
      num = tp.getTabCount();
      if (num != 1) return num;
      comp = tp.getComponentAt(0);
    }
    if (comp instanceof VToolPanel) num = ((VToolPanel) comp).getOpenCount();
    else if (comp instanceof PushpinIF) {
      if (!((PushpinIF) comp).isOpen()) num = 0;
    }

    return num;
  }
Пример #11
0
    protected void layoutUIComponents(String strPath, boolean bDefaultFile) {
      // gbc.weightx = 0.5;

      showInstructions(m_gbl, m_gbc, 0, 0, 7, infoLabel1);
      showInstructions(m_gbl, m_gbc, 0, 1, 7, infoLabel2);
      showInstructions(m_gbl, m_gbc, 0, 2, 7, infoLabel3);
      /*showInstructions( gbl, gbc, 0, 3, 7, infoLabel4 );
      showInstructions( gbl, gbc, 0, 4, 7, infoLabel5 );*/
      showInstructions(m_gbl, m_gbc, 0, 5, 1, new JLabel(""));

      // i18n
      // label = new JLabel( "LABEL" );
      label = new JLabel(Util.getAdmLabel("_adm_LABEL"));
      label.setForeground(Color.black);
      m_gbc.gridx = 1;
      m_gbc.gridy = 5;
      // gbc.ipadx = 10;
      m_gbl.setConstraints(label, m_gbc);
      m_pnlDisplay.add(label);

      label = new JLabel("     ");
      m_gbc.gridx = 2;
      m_gbc.gridy = 5;
      m_gbc.ipadx = 0;
      m_gbc.gridwidth = 5;
      m_gbc.weightx = 0;
      m_gbl.setConstraints(label, m_gbc);
      // add( label );

      // i18n
      // showInstructions( m_gbl, m_gbc, 2, 5, 1, new JLabel( "DIRECTORY" ));
      showInstructions(m_gbl, m_gbc, 2, 5, 1, new JLabel(Util.getAdmLabel("_adm_DIRECTORY")));

      m_nRow = 5;

      m_bDefaultFile = bDefaultFile;
      m_objTxfValue.clearArrays();
      displayNewTxf(strPath);

      m_pnlDisplay.setBorder(
          new CompoundBorder(
              // i18n
              // BorderFactory.createTitledBorder( "  Parent Directories  "),
              BorderFactory.createTitledBorder(Util.getAdmLabel("_adm_Parent_Directories")),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
Пример #12
0
  private Component getSelectedObj() {
    if (tabbedToolPanel.getComponentCount() < 1) return null;
    Component comp = tabbedToolPanel.getComponent(0);
    if (comp instanceof JTabbedPane) {
      JTabbedPane tp = (JTabbedPane) comp;
      if (tp.getTabCount() == 1) {
        comp = tp.getComponentAt(0);
      } else if (tp.getTabCount() > 1) {
        comp = tp.getSelectedComponent();
      }
    }
    if (comp instanceof VToolPanel) return comp;

    if (!(comp instanceof XMLToolPanel)) {
      if (comp instanceof PushpinIF) comp = ((PushpinIF) comp).getPinObj();
    }
    return comp;
  }
Пример #13
0
 private void clearPanel() {
   tabbedPane.removeAll();
   tabbedToolPanel.removeAll();
   panes.clear();
   keys.clear();
   vpInfo.clear();
   toolList.clear();
   objList.clear();
   removeAllPushpinComp();
   for (int i = 0; i < nviews; i++) tp_paneInfo[i].clear();
 }
Пример #14
0
 private void showComp(
     GridBagLayout gbl,
     GridBagConstraints gbc,
     int gridx,
     int gridy,
     int gridwidth,
     JComponent comp) {
   gbc.gridx = gridx;
   gbc.gridy = gridy;
   gbl.setConstraints(comp, gbc);
   m_pnlDisplay.add(comp);
 }
Пример #15
0
  private boolean containTool(JComponent obj) {
    int k, num;

    if (obj == null) return false;
    Component src = (Component) obj;
    Component comp;
    if (tabbedPane != null) {
      num = tabbedPane.getTabCount();
      for (k = 0; k < num; k++) {
        comp = tabbedPane.getComponentAt(k);
        if (src == comp) return true;
      }
    }
    if (tabbedToolPanel != null) {
      num = tabbedToolPanel.getComponentCount();
      for (k = 0; k < num; k++) {
        comp = tabbedToolPanel.getComponent(k);
        if (src == comp) return true;
      }
    }
    return false;
  }
Пример #16
0
 private void showInstruction(
     GridBagLayout gbl,
     GridBagConstraints gbc,
     int gridx,
     int gridy,
     int gridwidth,
     JLabel instruction) {
   gbc.gridwidth = gridwidth;
   gbc.gridx = gridx;
   gbc.gridy = gridy;
   gbl.setConstraints(instruction, gbc);
   instruction.setForeground(Color.black);
   m_pnlDisplay.add(instruction);
 }
Пример #17
0
  public UserDirectoryDialog(int nBuild) {
    super("View Directories");
    initBlink();
    try {
      // UIManager.setLookAndFeel( "javax.swing.plaf.metal.MetalLookAndFeel" );
    } catch (Exception exc) {
      System.out.println("Error loading L&F: " + exc);
    }

    AppIF appIf = Util.getAppIF();
    if (appIf instanceof VAdminIF) m_adminIF = (VAdminIF) appIf;

    if (nBuild == BUILD_ALL) {
      JPanel left = new JPanel();
      left.setOpaque(true);
      left.setLayout(new BorderLayout());
      left.add(new ConstraintsPanel(), BorderLayout.CENTER);

      JPanel right = new JPanel();
      right.setLayout(new BorderLayout());
      right.setOpaque(true);
      // right.setBackground( Color.white );

      JTreeTableAdmin treeTable = new JTreeTableAdmin(new FileSystemModelAdmin());
      right.add(new JScrollPane(treeTable), BorderLayout.CENTER);

      JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right);
      pane.setContinuousLayout(true);
      pane.setOneTouchExpandable(true);
      getContentPane().add(pane, BorderLayout.CENTER);
    }

    m_mlTxf =
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            if (timer != null) timer.cancel();
            if (e.getSource() instanceof JTextField) {
              JTextField txf2 = (JTextField) e.getSource();
              String strTxt = txf2.getText();
              if (strTxt != null && strTxt.equals(INFOSTR)) txf2.setText("");
            }
          }
        };
  }
Пример #18
0
  protected void setPref() {
    Color color = DisplayOptions.getColor("PlainText");
    Font font = DisplayOptions.getFont("PlainText");
    m_lblUsername.setForeground(color);
    m_lblUsername.setFont(font);
    m_lblPassword.setForeground(color);
    m_lblPassword.setFont(font);
    m_cmbUser.getEditor().getEditorComponent().setForeground(color);
    m_cmbUser.getEditor().getEditorComponent().setFont(font);
    m_passwordField.setForeground(color);
    m_passwordField.setFont(font);

    color = DisplayOptions.getColor("Heading3");
    font = DisplayOptions.getFont("Heading3");
    m_lblSampleName.setForeground(color);
    m_pnlTrays.setBorder(
        BorderDeli.createBorder("Empty", "Sample Trays", "Bottom", "Center", color, font));
    VBox.setforeground(color);
    VBox.setfont(font);
  }
Пример #19
0
  public void fill() {
    int i;
    boolean bSameFile = true;
    File fd = null;
    VToolPanel toolPanel = null;

    String toolPanelFile = FileUtil.openPath("INTERFACE/TabbedToolPanel.xml");
    if (toolPanelFile != null) fd = new File(toolPanelFile);
    if (fd != null && fd.exists()) {
      bSameFile = false;
      if (buildFile != null && buildFile.equals(toolPanelFile)) {
        if (fd.lastModified() == dateOfbuildFile) // same file
        bSameFile = true;
      }
    }
    if (bSameFile) {
      for (i = 0; i < objList.size(); i++) {
        JComponent obj = (JComponent) objList.get(i);
        if (obj != null) {
          if (obj instanceof VToolPanel) toolPanel = (VToolPanel) obj;
          else {
            if (obj instanceof StatusListenerIF) ExpPanel.addStatusListener((StatusListenerIF) obj);
            else if (obj instanceof ExpListenerIF) ExpPanel.addExpListener((ExpListenerIF) obj);
          }
        }
      }
      if (toolPanel != null) toolPanel.fill();
      return;
    }
    for (i = 0; i < objList.size(); i++) {
      for (i = 0; i < objList.size(); i++) {
        JComponent obj = (JComponent) objList.get(i);
        if (obj != null) {
          if (obj instanceof VToolPanel) toolPanel = (VToolPanel) obj;
        }
      }
    }
    if (toolPanel != null) toolPanel.clearAll();

    buildFile = toolPanelFile;
    if (fd != null) dateOfbuildFile = fd.lastModified();

    clearPanel();
    try {
      SAXParserFactory spf = SAXParserFactory.newInstance();
      spf.setValidating(false); // set to true if we get DOCTYPE
      spf.setNamespaceAware(false); // set to true with referencing
      SAXParser parser = spf.newSAXParser();
      if (toolPanelFile == null) {
        /* get VToolPanel only */
        String key = "Locator";
        PushpinIF pObj;
        Constructor c = (Constructor) getTool(key);
        Object[] vargs = new Object[1];
        vargs[0] = sshare;
        if (c != null) {
          JComponent comp = (JComponent) c.newInstance(vargs);
          if (comp instanceof VToolPanel) {
            toolList.add(comp);
          }
          tabbedToolPanel.add(comp);
          objList.add(comp);
          if (!(comp instanceof PushpinIF)) {
            pObj = new PushpinObj(comp, pinPanel);
            // pObj.setTitle("Tool Panel");
            pObj.showPushPin(false);
            pObj.showTitle(false);
            // pObj.alwaysShowTab(true);
          } else pObj = (PushpinIF) comp;
          pObj.setContainer(pinPanel);
          pObj.setSuperContainer(pinPanel);
          addTabComp(pObj);
          panes.put(key, pObj);
          // panes.put(key,comp);
          keys.add(key);
          vpInfo.add("all");
          for (i = 0; i < nviews; i++) tp_paneInfo[i].put(key, "yes");
        }
      } else {
        parser.parse(new File(toolPanelFile), new MySaxHandler());
      }

    } catch (ParserConfigurationException pce) {
      System.out.println("The underlying parser does not support the " + "requested feature(s).");
    } catch (FactoryConfigurationError fce) {
      System.out.println("Error occurred obtaining SAX Parser Factory.");
    } catch (Exception e) {
      e.printStackTrace();
    }

    for (i = 0; i < toolList.size(); i++) ((VToolPanel) toolList.get(i)).fill();
  }
Пример #20
0
  protected void dolayout(String strDir, String strFreq, String strTraynum) {
    // TopBar
    String strTitle = gettitle(strFreq);
    Color color = DisplayOptions.getColor("Heading3");

    // Center Panel
    JPanel panelCenter = new JPanel(new GridBagLayout());
    GridBagConstraints gbc =
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.2,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0);
    ImageIcon icon = getImageIcon();
    // panelCenter.add(new JLabel(icon));
    addComp(panelCenter, new JLabel(icon), gbc, 0, 0);
    strTitle = getSampleName(strDir, strTraynum);
    m_lblSampleName = new JLabel(strTitle);
    if (strTitle == null || !strTitle.trim().equals("")) strTitle = "3";
    Font font = m_lblSampleName.getFont();
    font = DisplayOptions.getFont(font.getName(), Font.BOLD, 300);
    m_lblSampleName.setFont(font);
    m_lblSampleName.setForeground(color);
    // panelCenter.add(m_lblSampleName);
    m_pnlSampleName = new JPanel(new CardLayout());
    m_pnlSampleName.add(m_lblSampleName, OTHER);
    addComp(panelCenter, m_pnlSampleName, gbc, 1, 0);
    m_pnlSampleName.setVisible(false);
    m_pnlTrays = new JPanel(new GridLayout(1, 0));
    // Vast panels
    VBox pnlVast1 = new VBox(m_pnlTrays, "1");
    m_pnlTrays.add(pnlVast1);
    m_pnlVast[0] = pnlVast1;
    VBox pnlVast2 = new VBox(m_pnlTrays, "2");
    m_pnlTrays.add(pnlVast2);
    m_pnlVast[1] = pnlVast2;
    VBox pnlVast3 = new VBox(m_pnlTrays, "3");
    m_pnlTrays.add(pnlVast3);
    m_pnlVast[2] = pnlVast3;
    VBox pnlVast4 = new VBox(m_pnlTrays, "4");
    m_pnlTrays.add(pnlVast4);
    m_pnlVast[3] = pnlVast4;
    VBox pnlVast5 = new VBox(m_pnlTrays, "5");
    m_pnlTrays.add(pnlVast5);
    m_pnlVast[4] = pnlVast5;
    m_pnlSampleName.add(m_pnlTrays, VAST);

    // Login Panel
    JPanel panelThird = new JPanel(new BorderLayout());
    JPanel panelLogin = new JPanel(new GridBagLayout());
    gbc = new GridBagConstraints();
    panelThird.add(panelLogin);
    Object[] aStrUser = getOperators();
    m_cmbUser = new JComboBox(aStrUser);
    BasicComboBoxRenderer renderer = new BasicComboBoxRenderer();
    m_cmbUser.setRenderer(renderer);
    m_cmbUser.setEditable(true);
    m_passwordField = new JPasswordField();
    // *Warning, working around a Java problem*
    // When we went to the T3500 running Redhat 5.3, the JPasswordField
    // fields sometimes does not allow ANY entry of characters.  Setting
    // the enableInputMethods() to true fixed this problem.  There are
    // comments that indicate that this could cause the typed characters
    // to be visible.  I have not found that to be a problem.
    // This may not be required in the future, or could cause characters
    // to become visible in the future if Java changes it's code.
    // GRS  8/20/09
    m_passwordField.enableInputMethods(true);

    m_lblLogin = new VLoginLabel(null, "Incorrect username/password \n Please try again ", 0, 0);
    m_lblLogin.setVisible(false);
    okButton.setActionCommand("enter");
    okButton.addActionListener(this);
    cancelButton.setActionCommand("cancel");
    cancelButton.addActionListener(this);
    helpButton.setActionCommand("help");
    helpButton.addActionListener(this);
    m_passwordField.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) enterLogin();
          }
        });

    // These is some wierd problem such that sometimes, the vnmrj command
    // area gets the focus and these items in the login box do not get
    // the focus.  Even clicking in these items does not bring focus to
    // them.  Issuing requestFocus() does not bring focus to them.
    // I can however, determing if either the operator entry box or
    // the password box has focus and if neither does, I can unshow and
    // reshow the panel and that fixes the focus.  So, I have added this
    // to the mouseClicked action.  If neither has focus, it will
    // take focus with setVisible false then true.
    comboTextField = m_cmbUser.getEditor().getEditorComponent();
    m_passwordField.addMouseListener(this);
    comboTextField.addMouseListener(this);

    m_lblUsername = new JLabel(Util.getLabel("_Operator"));
    addComp(panelLogin, m_lblUsername, gbc, 0, 0);
    addComp(panelLogin, m_cmbUser, gbc, 1, 0);
    m_lblPassword = new JLabel(Util.getLabel("_Password"));
    addComp(panelLogin, m_lblPassword, gbc, 0, 1);
    addComp(panelLogin, m_passwordField, gbc, 1, 1);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.gridheight = GridBagConstraints.REMAINDER;
    addComp(panelLogin, m_lblLogin, gbc, 2, 0);
    setPref();

    Container container = getContentPane();
    JPanel panelLoginBox = new JPanel(new BorderLayout());
    panelLoginBox.add(panelCenter, BorderLayout.CENTER);
    panelLoginBox.add(panelThird, BorderLayout.SOUTH);
    container.add(panelLoginBox, BorderLayout.CENTER);
  }