예제 #1
0
  /*Przycisk Dodaj Ocene wywo³uje nowe okienko */
  void DodajOcene(JDesktopPane a) {

    JDesktopPane desktopPane = a;
    final JButton btnDodajOcene = new JButton("Dodaj ocen\u0119");
    btnDodajOcene.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent akcja) {
            if (akcja.getSource() == btnDodajOcene) {
              closelButtonActionPerformed(akcja);

              DodajOcene.main(null);
            }
          }
        });

    btnDodajOcene.setBounds(10, 399, 132, 39);

    desktopPane.add(btnDodajOcene);

    JButton btnPrio = new JButton("Ustaw priorytet");
    btnPrio.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // lblChemia.setForeground(Color.RED);
            // UstawPriorytet ustawPriorytet = new UstawPriorytet();
            closelButtonActionPerformed(e);
            UstawPriorytet.main(null);
          }
        });
    btnPrio.setBounds(10, 449, 132, 39);
    desktopPane.add(btnPrio);
  }
예제 #2
0
  /**
   * This method handels the creation of a new DrawingArea
   *
   * @param projectName Name of project created
   */
  private void createDrawing(String projectName) {
    if (firstStartup) {
      dailyTips();
      firstStartup = false;
    }

    drawingArea = new DrawingArea(toolbox, toolSettings, activeColorSettings);
    drawingArea.setProjectName(projectName.toLowerCase());

    Dimension desktopSize = jDesktopPane.getSize();
    Dimension jInternalFrameSize = drawingArea.getSize();
    drawingArea.setLocation(
        (desktopSize.width - jInternalFrameSize.width) / 2,
        (desktopSize.height - jInternalFrameSize.height) / 2);

    drawingArea.setTitle("Prosjekt: " + projectName);

    drawingArea.setVisible(true);

    jDesktopPane.add(drawingArea);
    try {
      drawingArea.setSelected(true);
    } catch (PropertyVetoException e) {
      e.printStackTrace();
    }
  }
 protected void installDesktopManager() {
   desktopManager = desktop.getDesktopManager();
   if (desktopManager == null) {
     desktopManager = new BasicDesktopManager();
     desktop.setDesktopManager(desktopManager);
   }
 }
예제 #4
0
  /** Creates the GUI in a new thread. */
  @Override
  public void run() {
    setContentPane(jDesktopPane);

    // Show parent frame
    setVisible(true);

    // Create menubar
    setJMenuBar(createMenuBar());

    // Create toolsettings as an internal frame.
    toolSettings = new ActiveToolSettings();
    desktopSize = jDesktopPane.getSize();
    internalFrameSize = toolSettings.getSize();
    toolSettings.setLocation((screenSize.width - internalFrameSize.width) / 2, 0);
    jDesktopPane.add(toolSettings, JLayeredPane.PALETTE_LAYER);
    toolSettings.setVisible(true);

    // Create toolbox as an internal frame.
    toolbox = new Toolbox(toolSettings);
    toolbox.setLocation(0, 0);
    jDesktopPane.add(toolbox, JLayeredPane.PALETTE_LAYER);
    toolbox.setVisible(true);

    // Create panel with primary and secondary color
    activeColorSettings = new ActiveColorSettings(jDesktopPane);
    activeColorSettings.setLocation(82, 0);
    jDesktopPane.add(activeColorSettings, JLayeredPane.PALETTE_LAYER);
    activeColorSettings.setVisible(true);
  }
예제 #5
0
  /** Default constructor, creates a new frame. */
  public MainWindow() {
    super("Fargestiften");

    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setMinimumSize(new Dimension(640, 480));
    setExtendedState(getExtendedState() | JFrame.MAXIMIZED_BOTH);

    jDesktopPane = new JDesktopPane();
    desktopSize = jDesktopPane.getSize();

    firstStartup = true;

    // Create welcome screen
    StartupDialog startupDialog = new StartupDialog(this);

    internalFrameSize = startupDialog.getSize();
    startupDialog.setLocation(
        (screenSize.width - internalFrameSize.width) / 2,
        (screenSize.height - internalFrameSize.height) / 3);

    startupDialog.setVisible(true);

    jDesktopPane.add(startupDialog, JLayeredPane.MODAL_LAYER);
    try {
      startupDialog.setSelected(true);
    } catch (PropertyVetoException e) {
      e.printStackTrace();
    }

    serialization = new StorageSerialization();
  }
  /**
   * Adds a component to the middle layer of the desktop--that is, the layer for session node
   * editors. Note: The comp is a SessionEditor
   */
  public void addSessionEditor(SessionEditorIndirectRef editorRef) {
    SessionEditor editor = (SessionEditor) editorRef;

    JInternalFrame frame = new TetradInternalFrame(null);

    frame.getContentPane().add(editor);
    framesMap.put(editor, frame);
    editor.addPropertyChangeListener(this);

    // Set the "small" size of the frame so that it has sensible
    // bounds when the users unmazimizes it.
    Dimension fullSize = desktopPane.getSize();
    int smallSize = Math.min(fullSize.width - MARGIN, fullSize.height - MARGIN);
    Dimension size = new Dimension(smallSize, smallSize);
    setGoodBounds(frame, desktopPane, size);
    desktopPane.add(frame);

    // Set the frame to be maximized. This step must come after the frame
    // is added to the desktop. -Raul. 6/21/01
    try {
      frame.setMaximum(true);
    } catch (Exception e) {
      throw new RuntimeException("Problem setting frame to max: " + frame);
    }

    desktopPane.setLayer(frame, 0);
    frame.moveToFront();
    frame.setTitle(editor.getName());
    frame.setVisible(true);

    setMainTitle(editor.getName());
  }
예제 #7
0
  /**
   * Gerenciador de JInternalFrames
   *
   * @param jIFrame JInternalFrame : InternalFrame que se deseja gerenciar
   */
  public void manager(JInternalFrame jIFrame) {

    boolean isActive = false;
    JInternalFrame[] frames = dPane.getAllFrames();
    for (JInternalFrame jif : frames) {

      if (!reply) {
        if (jif.getClass().equals(jIFrame.getClass())) {
          isActive = true;
          jif.moveToFront();
          try {
            jif.setMaximum(true);
            jif.setMaximum(false);
          } catch (PropertyVetoException e) {
            e.printStackTrace();
          }
        }
      }
    }
    if (!isActive) {
      if (frames.length > 0) {
        cascata(jIFrame, frames[0]);
        jIFrame.setLocation(x, y);
      } else {
        jIFrame.setLocation(minX, minY);
      }

      dPane.add(jIFrame);
      jIFrame.setVisible(true);
    }
  }
예제 #8
0
  private void cascata(JInternalFrame jIFrame, JInternalFrame jIFrameAnt) {

    if (dPane.getAllFrames().length > 0) {
      if (autoManager) {
        maxX = dPane.getWidth() - jIFrame.getWidth();
        maxY = dPane.getHeight() - jIFrame.getHeight();
        minX = 0;
        minY = 0;
      }
      if (jIFrameAnt.getY() < maxY) {
        y = jIFrameAnt.getY() + distanceXY;
      } else {
        y = minY;
      }
      if (jIFrameAnt.getX() < maxX) {

        x = jIFrameAnt.getX() + distanceXY;

      } else {
        x = minX;
        y = minY;
      }
    } else {
      x = minX;
      y = minY;
    }
  }
예제 #9
0
 public void init() {
   // 向内部窗口中添加组件
   iframe.add(new JScrollPane(new JTextArea(8, 40)));
   desktop.setPreferredSize(new Dimension(400, 300));
   // 把虚拟桌面添加到JFrame窗口中
   jf.add(desktop);
   // 设置内部窗口的大小、位置
   iframe.reshape(0, 0, 300, 200);
   // 显示并选中内部窗口
   iframe.show();
   desktop.add(iframe);
   JPanel jp = new JPanel();
   deskBn.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent event) {
           // 弹出内部对话框,以虚拟桌面作为父组件
           JOptionPane.showInternalMessageDialog(desktop, "属于虚拟桌面的对话框");
         }
       });
   internalBn.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent event) {
           // 弹出内部对话框,以内部窗口作为父组件
           JOptionPane.showInternalMessageDialog(iframe, "属于内部窗口的对话框");
         }
       });
   jp.add(deskBn);
   jp.add(internalBn);
   jf.add(jp, BorderLayout.SOUTH);
   jf.pack();
   jf.setVisible(true);
 }
 public void xtestTiming() {
   final JDialog dialog = new JDialog((JFrame) null, "TestTiming");
   JDesktopPane pane = new JDesktopPane();
   dialog.setContentPane(pane);
   final Object[] f = {null};
   for (int i = 99; i >= 0; i--) {
     JInternalFrame frame = new JInternalFrame("Internal Frame - " + i, true, true, true, true);
     JButton s = new JButton("button" + i);
     s.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             final long start = System.currentTimeMillis();
             System.err.println("TestMarathonNamingStrategy.testTiming(): " + start);
             namingStrategy.setTopLevelComponent(dialog, true);
             String name = namingStrategy.getName((Component) e.getSource());
             System.err.println(
                 "TestMarathonNamingStrategy.testTiming(): name = "
                     + name
                     + "::"
                     + (System.currentTimeMillis() - start));
           }
         });
     f[0] = s;
     frame.getContentPane().add(s);
     frame.pack();
     frame.setLocation(i, i);
     frame.setVisible(true);
     pane.add(frame);
   }
   dialog.setSize(500, 500);
   dialog.setModal(true);
   dialog.setVisible(true);
   System.err.println(
       "TestMarathonNamingStrategy.testTiming(): " + ((Component) f[0]).isVisible());
 }
예제 #11
0
  public Object showWindow(final MkWindow macWindow, String title, boolean isModal) {
    listMkWindow.add(macWindow);
    if (isModal) {
      JDialog modalFrame = new JDialog(this, title, true);
      // macWindow.setJanela(modalFrame);
      final MkRun onCloseWindow = macWindow.onCloseWindow;
      modalFrame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);
      modalFrame.addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              if (onCloseWindow != null) {
                onCloseWindow.execute();
              }
              disposeWindow(macWindow);
            }
          });
      modalFrame.setLayout(new BorderLayout());
      modalFrame.add(macWindow, BorderLayout.CENTER);
      modalFrame.pack();
      Dimension desktopSize = desktopPane.getSize();
      int x = (desktopSize.width - modalFrame.getWidth()) / 2;
      int y = (desktopSize.height - modalFrame.getHeight()) / 2;
      modalFrame.setLocation((x < 0 ? 0 : x), (y < 0 ? 0 : y));
      if (macWindow.panelButton != null) {
        modalFrame.getRootPane().setDefaultButton((JButton) macWindow.panelButton.getComponent(0));
      }
      modalFrame.setVisible(true);
      return modalFrame;
    } else {
      JInternalFrame internalFrame = new JInternalFrame(title, true, true, true, true);
      internalFrame.setContentPane(macWindow);
      internalFrame.pack();
      //            internalFrame.setBounds(internalFrame.getBounds()); //pq?
      desktopPane.add(internalFrame);

      internalFrame.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
      final MkRun onCloseWindow = macWindow.onCloseWindow;
      if (onCloseWindow != null) {
        internalFrame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);

        internalFrame.addInternalFrameListener(
            new InternalFrameAdapter() {
              public void internalFrameClosing(InternalFrameEvent e) {
                onCloseWindow.execute();
              }
            });
      }

      Dimension desktopSize = desktopPane.getSize();
      int x = (desktopSize.width - internalFrame.getWidth()) / 2;
      int y = (desktopSize.height - internalFrame.getHeight()) / 2;
      internalFrame.setLocation((x < 0 ? 0 : x), (y < 0 ? 0 : y));
      internalFrame.setVisible(true);
      return internalFrame;
    }
  }
 private void setState(JDesktopPane dp, String state) {
   if (state == CLOSE) {
     JInternalFrame f = dp.getSelectedFrame();
     if (f == null) {
       return;
     }
     f.doDefaultCloseAction();
   } else if (state == MAXIMIZE) {
     // maximize the selected frame
     JInternalFrame f = dp.getSelectedFrame();
     if (f == null) {
       return;
     }
     if (!f.isMaximum()) {
       if (f.isIcon()) {
         try {
           f.setIcon(false);
           f.setMaximum(true);
         } catch (PropertyVetoException pve) {
         }
       } else {
         try {
           f.setMaximum(true);
         } catch (PropertyVetoException pve) {
         }
       }
     }
   } else if (state == MINIMIZE) {
     // minimize the selected frame
     JInternalFrame f = dp.getSelectedFrame();
     if (f == null) {
       return;
     }
     if (!f.isIcon()) {
       try {
         f.setIcon(true);
       } catch (PropertyVetoException pve) {
       }
     }
   } else if (state == RESTORE) {
     // restore the selected minimized or maximized frame
     JInternalFrame f = dp.getSelectedFrame();
     if (f == null) {
       return;
     }
     try {
       if (f.isIcon()) {
         f.setIcon(false);
       } else if (f.isMaximum()) {
         f.setMaximum(false);
       }
       f.setSelected(true);
     } catch (PropertyVetoException pve) {
     }
   }
 }
 /** Returns a reasonable divider location for the log output. */
 private int getDivider() {
   int height;
   if (desktopPane.getSize().height == 0) {
     Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
     height = size.height;
   } else {
     height = desktopPane.getSize().height;
   }
   return (int) (height * .80);
 }
 public void testFindsTopLevelWindowIfActiveWindowIsInternalFrame() {
   JFrame frame = new JFrame("testTopLevelWindow");
   JDesktopPane pane = new JDesktopPane();
   JInternalFrame internalFrame = new JInternalFrame("Test");
   pane.add(internalFrame);
   frame.setContentPane(pane);
   windowContext.setActiveWindow(internalFrame);
   assertSame(frame, windowContext.activeTopLevelWindow());
   frame.dispose();
 }
예제 #15
0
  @Override
  protected void initializeSwing() {
    super.initializeSwing();
    JDesktopPane swingDesktop = new JDesktopPane();
    setSwingField(swingDesktop);
    //
    swingDesktop.setDesktopManager(new MultiSplitDesktopManager());
    IMultiSplitStrategy columnSplitStrategy = createMultiSplitStrategy();
    MultiSplitLayout layout = new MultiSplitLayout(columnSplitStrategy);
    swingDesktop.setLayout(layout);
    swingDesktop.setOpaque(true);
    // cursor
    swingDesktop.setCursor(null);

    // focus root
    swingDesktop.setFocusCycleRoot(false);
    swingDesktop.setFocusTraversalPolicy(null);
    // AWE: this could be integrated in new ui (was forgotton in metal laf)
    swingDesktop
        .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
        .put(SwingUtility.createKeystroke("shift ctrl TAB"), "selectPreviousFrame");
    // register ctrl-TAB and ctrl-shift-TAB actions according to ui
    swingDesktop.getActionMap().put("selectNextFrame", new P_SwingTabFrameAction(1));
    swingDesktop.getActionMap().put("selectPreviousFrame", new P_SwingTabFrameAction(-1));
    // development shortcuts
    SwingUtility.installDevelopmentShortcuts(getSwingDesktopPane());
  }
예제 #16
0
파일: BIDE.java 프로젝트: enbiso/openbaraza
  public void actionPerformed(ActionEvent ev) {
    String aKey = ev.getActionCommand();

    if ("New Project".equals(aKey)) {
      BDevelop newdevdesk = new BDevelop(root, top, treemodel, configDir, logHandle);
      newdevdesk.setVisible(true);
      desktop.add(newdevdesk);
      try {
        newdevdesk.setSelected(true);
      } catch (java.beans.PropertyVetoException ex) {
        log.severe("Desktop show error : " + ex);
      }
    } else if ("Close Project".equals(aKey)) {
      closeProject(false);
    } else if ("Delete Project".equals(aKey)) {
      closeProject(true);
    } else if ("Save Projects".equals(aKey)) {
      Bio io = new Bio();
      io.saveFile(configDir + configFile, root.toString());
    } else if ("Encrypt File".equals(aKey)) {
      // Create encrypter/decrypter class and encrypt
      String encryFile = configFile.substring(0, configFile.length() - 3) + "cph";
      BDesEncrypter encrypter = new BDesEncrypter(root.getAttribute("encryption"));
      encrypter.encrypt(configDir + configFile, configDir + encryFile);
    } else if ("Open Applications".equals(aKey)) {
      // Create a file chooser
      JFileChooser fc = new JFileChooser(configDir);
      int returnVal = fc.showOpenDialog(this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        File cnFile = fc.getSelectedFile();
        configDir = cnFile.getParent() + "/";
        configFile = cnFile.getName();

        BXML xml = new BXML(configDir + configFile, false);
        root = xml.getRoot();
        top = new BTreeNode(root, "APP");
        for (BElement el : root.getElements()) top.add(new BTreeNode(el, el.getValue()));

        treemodel.setRoot(top);
        treemodel.reload();
      }
    } else if ("About".equals(aKey)) {
      BAbout about = new BAbout("IDE");
      about.setVisible(true);
      desktop.add(about);
      try {
        about.setSelected(true);
      } catch (java.beans.PropertyVetoException ex) {
        log.severe("Desktop show error : " + ex);
      }
    }
  }
예제 #17
0
 void ResetujDane(JDesktopPane a) {
   JDesktopPane desktopPane = a;
   JButton btnResetujDane = new JButton("Resetuj Dane");
   btnResetujDane.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           closelButtonActionPerformed(e);
           ResetujDane.main(null);
         }
       });
   btnResetujDane.setBounds(432, 520, 132, 39);
   desktopPane.add(btnResetujDane);
 }
예제 #18
0
  /**
   * This method handles the loading of an existing project into a new DrawingArea. Gives feedback
   * to the user if project is not found or incompatible with the current version
   *
   * @param projectName Name of project to load
   */
  private void loadDrawing(String projectName) {
    if (firstStartup) {
      dailyTips();
      firstStartup = false;
    }

    drawingArea = new DrawingArea(toolbox, toolSettings, activeColorSettings);
    drawingArea.setProjectName(projectName.toLowerCase());

    try {
      serialization.load(drawingArea, projectName.toLowerCase());

      Dimension desktopSize = jDesktopPane.getSize();
      Dimension jInternalFrameSize = drawingArea.getSize();
      drawingArea.setLocation(
          (desktopSize.width - jInternalFrameSize.width) / 2,
          (desktopSize.height - jInternalFrameSize.height) / 2);

      drawingArea.setTitle("Prosjekt: " + projectName);

      drawingArea.setVisible(true);

      jDesktopPane.add(drawingArea);

    } catch (StorageException ex) {
      // ex.printStackTrace();
      Toolkit.getDefaultToolkit().beep();
      JOptionPane.showMessageDialog(
          null, "Fant ikke prosjektet på serveren.", "Feil", JOptionPane.ERROR_MESSAGE);

    } catch (IOException ex) {
      // ex.printStackTrace();
      Toolkit.getDefaultToolkit().beep();
      JOptionPane.showMessageDialog(
          null,
          "Dette prosjektet ble laget på en eldre versjon av programmet.\n"
              + "Dessverre er det ikke kompatibelt med nåværende versjon.",
          "Gammel versjon",
          JOptionPane.ERROR_MESSAGE);

    } catch (URISyntaxException | ClassNotFoundException ex) {
      ex.printStackTrace();
    }

    try {
      drawingArea.setSelected(true);
    } catch (PropertyVetoException e) {
      e.printStackTrace();
    }
  }
  /** Constructs a new desktop. */
  public TetradDesktop() {
    setBackground(new Color(204, 204, 204));
    sessionNodeKeys = new ArrayList();
    // Create the desktop pane.
    this.desktopPane = new JDesktopPane();

    // Do layout.
    setLayout(new BorderLayout());
    desktopPane.setDesktopManager(new DefaultDesktopManager());
    desktopPane.setBorder(new BevelBorder(BevelBorder.LOWERED));
    desktopPane.addPropertyChangeListener(this);

    this.setupDesktop();
    TetradLogger.getInstance().addTetradLoggerListener(new LoggerListener());
  }
  /**
   * Randomly picks the location of a new window, such that it fits completely on the screen.
   *
   * @param desktopPane the desktop pane that the frame is being added to.
   * @param frame the JInternalFrame which is being added.
   * @param desiredSize the desired dimensions of the frame.
   */
  private static void setGoodBounds(
      JInternalFrame frame, JDesktopPane desktopPane, Dimension desiredSize) {
    RandomUtil randomUtil = RandomUtil.getInstance();
    Dimension desktopSize = desktopPane.getSize();

    Dimension d = new Dimension(desiredSize);
    int tx = desktopSize.width - d.width;
    int ty = desktopSize.height - d.height;

    if (tx < 0) {
      tx = 0;
      d.width = desktopSize.width;
    } else {
      tx = (int) (randomUtil.nextDouble() * tx);
    }

    if (ty < 0) {
      ty = 0;
      d.height = desktopSize.height;
    } else {
      ty = (int) (randomUtil.nextDouble() * ty);
    }

    frame.setBounds(tx, ty, d.width, d.height);
  }
예제 #21
0
  /**
   * Returns a JMenu object for use in the JMenuBar.
   *
   * @return JMenu
   */
  private JMenu getAboutMenu() {

    JMenu aboutMenu = new JMenu("Om");
    aboutMenu.setMnemonic('o');

    JMenuItem tipsItem = new JMenuItem("Dagens tips");
    tipsItem.setMnemonic('d');
    tipsItem.addActionListener(evt -> dailyTips());

    JMenuItem aboutItem = new JMenuItem("Om Fargestiften");
    aboutItem.setMnemonic('o');
    aboutItem.addActionListener(
        evt -> {
          AboutDialog about = new AboutDialog();

          internalFrameSize = about.getSize();
          about.setLocation(
              (desktopSize.width - internalFrameSize.width) / 2,
              (desktopSize.height - internalFrameSize.height) / 2);

          about.setVisible(true);

          jDesktopPane.add(about, JLayeredPane.MODAL_LAYER);
          try {
            about.setSelected(true);
          } catch (PropertyVetoException e) {
            e.printStackTrace();
          }
        });

    aboutMenu.add(tipsItem);
    aboutMenu.add(aboutItem);

    return aboutMenu;
  }
예제 #22
0
  void windowMenu_menuSelected(MenuEvent e) {
    // <<TODO:MAINTAINABILITY>> This algorithm is not robust. It assumes
    // the Window
    // menu has exactly one "regular" menu item (newWindowMenuItem). [Jon
    // Aquino]
    if (windowMenu.getItemCount() > 0
        && windowMenu.getItem(0) != null
        && windowMenu
            .getItem(0)
            .getText()
            .equals(AbstractPlugIn.createName(CloneWindowPlugIn.class))) {
      JMenuItem newWindowMenuItem = windowMenu.getItem(0);
      windowMenu.removeAll();
      windowMenu.add(newWindowMenuItem);
      windowMenu.addSeparator();
    } else {
      // ezLink doesn't have a Clone Window menu [Jon Aquino]
      windowMenu.removeAll();
    }

    // final TaskComponent[] frames = (TaskComponent[]) desktopPane.getAllFrames();
    final JInternalFrame[] frames = desktopPane.getAllFrames();
    for (int i = 0; i < frames.length; i++) {
      JMenuItem menuItem = new JMenuItem();
      // Increase truncation threshold from 20 to 40, for eziLink [Jon
      // Aquino]
      menuItem.setText(GUIUtil.truncateString(frames[i].getTitle(), 40));
      associate(menuItem, frames[i]);
      windowMenu.add(menuItem);
    }
    if (windowMenu.getItemCount() == 0) {
      // For ezLink [Jon Aquino]
      windowMenu.add(new JMenuItem("(No Windows)"));
    }
  }
 private void jMenuItemViewLSAResultsActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jMenuItemViewLSAResultsActionPerformed
   if (this.currentResults != null) {
     LSAResultsFrame f = new LSAResultsFrame(this.currentResults, this.theProject);
     theDesktop.add(f);
   }
 } // GEN-LAST:event_jMenuItemViewLSAResultsActionPerformed
예제 #24
0
 public void verificaTelaAberta(String nomeTela) {
   if (ctlTela == null) {
     switch (nomeTela) {
       case "Pedido":
         ctlTela = new ctlPedido(nomeTela, this);
         break;
       case "Receber Pedidos Pendentes":
         ctlTela = new ctlReceberPedidosPendentes(nomeTela, this);
         break;
       case "Realizar Entrega":
         ctlTela = new ctlRealizarEntrega(nomeTela, this);
         break;
       case "Efetuar Pagamento":
         ctlTela = new ctlEfetuarPagamento(nomeTela, this);
         break;
       case "Cadastrar Cliente":
         ctlTela = new ctlCadCliente(nomeTela, this);
         break;
       case "Cadastrar Produto":
         ctlTela = new ctlCadProduto(nomeTela, this);
         break;
     }
     try {
       ctlTela.setMaximum(true);
       jdPane.moveToFront(ctlTela);
     } catch (PropertyVetoException ex) {
       Logger.getLogger(frmMenu.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }
예제 #25
0
  public MainUI() {
    super("Neato Burrito");

    dLog.trace("In MainUI: " + MainUI.class.getCanonicalName());

    this.setBounds(0, 0, 500, 500);
    Container container = getContentPane();
    container.add(theDesktop);
    setJMenuBar(menubar);
    JMenu fileMenu = new JMenu("File");
    JMenuItem exitItem = new JMenuItem("Exit");
    exitItem.setMnemonic('X');
    exitItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });
    fileMenu.add(exitItem);
    menubar.add(fileMenu);

    StatusUI statUI = new StatusUI();
    statUI.setVisible(true);
    theDesktop.add(statUI);

    setDefaultCloseOperation(EXIT_ON_CLOSE);
    pack();
    setVisible(true);
  }
예제 #26
0
  private ProvidedObjectComboItem[] getComboItems(ConvertingPlugin plugin) {
    JInternalFrame[] frames = desktop.getAllFrames();
    ArrayList accepted = new ArrayList();
    comboItems = new ArrayList();

    for (int j = 0; j < frames.length; j++) {
      if (frames[j] instanceof Provider) {
        ProvidedObject[] po = ((Provider) frames[j]).getProvidedObjects();

        for (int i = 0; i < po.length; i++) {
          if (plugin.accepts(po[i])) {
            accepted.add(new ProvidedObjectComboItem(frames[j].getTitle(), po[i]));
            comboItems.add(po[i]);
          }
        }
      }
    }
    ProvidedObject[] po = MainUI.getInstance().getGlobalProvidedObjects();

    for (int i = 0; i < po.length; i++) {
      if (plugin.accepts(po[i])) {
        accepted.add(new ProvidedObjectComboItem("ProM Global Objects", po[i]));
        comboItems.add(po[i]);
      }
    }
    return (ProvidedObjectComboItem[]) accepted.toArray(new ProvidedObjectComboItem[0]);
  }
예제 #27
0
  @Override
  protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D gd = (Graphics2D) g.create();
    gd.setColor(new Color(220, 220, 240));
    gd.fillRect(0, 0, getWidth(), getHeight());

    // draw logo
    int width = getWidth();
    int height = getHeight();
    int stepX = 100;
    int stepY = 100;
    boolean flag1 = false, flag2;
    for (int y = 0; y <= height; y += stepY) {
      flag1 = !flag1;
      flag2 = flag1;
      for (int x = 0; x <= width; x += stepX) {
        if (flag2) {
          gd.drawImage(logoAveros, x, y, null);
        }
        flag2 = !flag2;
      }
    }
    gd.dispose();
  }
예제 #28
0
  /** dailyTips() method create the a internal frame with daily tips */
  private void dailyTips() {

    // Create a frame for daily tips
    DailyTip dailyTip = new DailyTip(this);
    jDesktopPane.add(dailyTip, JLayeredPane.MODAL_LAYER);
    dailyTip.setVisible(true);
  }
예제 #29
0
 @Override
 public void actionPerformed(ActionEvent actionEvent) {
   Dimension all = parent.getSize();
   Dimension d = dialog.getSize();
   dialog.setLocation((all.width - d.width) / 2, (all.height - d.height) / 2);
   dialog.setVisible(true);
 }
예제 #30
0
 /**
  * Creates an Internal Frame.
  *
  * @param name the name of the app
  * @throws ClassNotFoundException
  * @throws IllegalAccessException
  * @throws InstantiationException
  */
 private void createFrame(String name)
     throws InstantiationException, IllegalAccessException, ClassNotFoundException {
   AbstractTool ti = (AbstractTool) Class.forName((String) toolmap.get(name)).newInstance();
   JInternalFrame f = ti.getInternalFrame();
   f.setVisible(true);
   desktop.add(f);
 }