Beispiel #1
2
  AdminMain() {
    l = new JLabel();
    l.setBounds(10, 20, 1340, 1000);
    l.setBackground(Color.black);
    Font ft = new Font("Arial", Font.BOLD, 30);
    Font ft1 = new Font("Arial", Font.BOLD, 14);
    Font ft2 = new Font("Arial", Font.BOLD, 20);

    f1 = new Frame("Soft Test Management (Beta)");
    f1.setLayout(null);

    l1 = new Label("Test Instructions", l1.CENTER);
    l1.setBounds(10, 20, 1300, 60);
    l1.setForeground(Color.blue);
    l1.setBackground(Color.white);
    l1.setFont(ft);

    l2 = new JLabel("Deletion of Faculty/Students");
    l2.setBounds(20, 30, 1000, 500);
    l2.setBackground(Color.blue);
    l2.setFont(ft2);
    l3 = new JLabel("Test Pattern");
    l3.setBounds(20, 90, 1300, 500);
    l3.setBackground(Color.green);
    l3.setFont(ft2);

    b1 = new JButton("Go !");
    b1.setBounds(300, 220, 120, 30);
    b1.setBackground(Color.white);
    b1.setForeground(Color.blue);
    b1.setFont(ft2);

    b2 = new JButton("Go");
    b2.setBounds(300, 240, 120, 30);
    b2.setBackground(Color.white);
    b2.setForeground(Color.blue);
    b2.setFont(ft2);

    f1.add(l);
    l.add(l1);
    l2.add(b1);
    l.add(l2);
    l3.add(b2);
    l.add(l3);

    b1.addActionListener(this);
    b2.addActionListener(this);

    f1.setVisible(true);
    f1.setSize(1800, 800);
  }
  /**
   * @param owner the owner of this component
   * @param maxVersion the maximum version number which is valid
   */
  public CheckOutVersionDialog(Frame owner, int maxVersion) {
    super(owner, true);

    this.maxVersion = maxVersion;
    parentFrame = owner;

    versionTF = new JTextField(5);

    okButton = new JButton("Ok");
    okButton.addActionListener(this);

    JPanel versionPanel = new JPanel();
    JPanel buttonPanel = new JPanel();

    versionPanel.add(new JLabel("Version number to check out: "));
    versionPanel.add(versionTF);

    buttonPanel.add(okButton);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(versionPanel, BorderLayout.CENTER);
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    setLocation((int) owner.getLocation().getX() + 100, (int) owner.getLocation().getY() + 100);
    pack();
  }
Beispiel #3
0
    @Override
    public void actionPerformed(ActionEvent e) {
      Frame frame = getFrame();
      JFileChooser chooser = new JFileChooser();
      int ret = chooser.showOpenDialog(frame);

      if (ret != JFileChooser.APPROVE_OPTION) {
        return;
      }

      File f = chooser.getSelectedFile();
      if (f.isFile() && f.canRead()) {
        Document oldDoc = getEditor().getDocument();
        if (oldDoc != null) {
          oldDoc.removeUndoableEditListener(undoHandler);
        }
        if (elementTreePanel != null) {
          elementTreePanel.setEditor(null);
        }
        getEditor().setDocument(new PlainDocument());
        frame.setTitle(f.getName());
        Thread loader = new FileLoader(f, editor.getDocument());
        loader.start();
      } else {
        JOptionPane.showMessageDialog(
            getFrame(),
            "Could not open file: " + f,
            "Error opening file",
            JOptionPane.ERROR_MESSAGE);
      }
    }
  public void addClient() {
    client =
        new Canvas() {
          public void paint(Graphics g) {
            super.paint(g);
          }
        };
    client.setBackground(new Color(30, 220, 40));
    clientCont.add(client);
    clientCont.validate();
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    WindowIDProvider pid = (WindowIDProvider) acc.getPeer(client);
    log.fine("Added XEmbed server(Canvas) with X window ID " + pid.getWindow());
    Rectangle toFocusBounds = toFocus.getBounds();
    toFocusBounds.setLocation(toFocus.getLocationOnScreen());
    f.validate();

    // KDE doesn't accept clicks on title as activation - click below title
    Rectangle fbounds = f.getBounds();
    fbounds.y += f.getInsets().top;
    fbounds.height -= f.getInsets().top;

    Process proc =
        startClient(
            new Rectangle[] {
              fbounds,
              dummy.getBounds(),
              toFocusBounds,
              new Rectangle(b_modal.getLocationOnScreen(), b_modal.getSize()),
              new Rectangle(10, 130, 20, 20)
            },
            pid.getWindow());
    new ClientWatcher(client, proc, clientCont).start();
  }
    public void mouseMoved(MouseEvent ev) {
      JRootPane root = getRootPane();

      if (root.getWindowDecorationStyle() == JRootPane.NONE) {
        return;
      }

      Window w = (Window) ev.getSource();

      Frame f = null;
      Dialog d = null;

      if (w instanceof Frame) {
        f = (Frame) w;
      } else if (w instanceof Dialog) {
        d = (Dialog) w;
      }

      // Update the cursor
      int cursor = getCursor(calculateCorner(w, ev.getX(), ev.getY()));

      if (cursor != 0
          && ((f != null && (f.isResizable() && (f.getExtendedState() & Frame.MAXIMIZED_BOTH) == 0))
              || (d != null && d.isResizable()))) {
        w.setCursor(Cursor.getPredefinedCursor(cursor));
      } else {
        w.setCursor(lastCursor);
      }
    }
    public void mouseClicked(MouseEvent ev) {
      Window w = (Window) ev.getSource();
      Frame f = null;

      if (w instanceof Frame) {
        f = (Frame) w;
      } else {
        return;
      }

      Point convertedPoint = SwingUtilities.convertPoint(w, ev.getPoint(), getTitlePane());

      int state = f.getExtendedState();
      if (getTitlePane() != null && getTitlePane().contains(convertedPoint)) {
        if ((ev.getClickCount() % 2) == 0 && ((ev.getModifiers() & InputEvent.BUTTON1_MASK) != 0)) {
          if (f.isResizable()) {
            if ((state & Frame.MAXIMIZED_BOTH) != 0) {
              f.setExtendedState(state & ~Frame.MAXIMIZED_BOTH);
            } else {
              f.setExtendedState(state | Frame.MAXIMIZED_BOTH);
            }
            return;
          }
        }
      }
    }
 private static void maximizeIfNeeded(final Window owner) {
   if (owner == null) return;
   if (owner instanceof Frame) {
     Frame f = (Frame) owner;
     if (f.getState() == Frame.ICONIFIED) {
       f.setState(Frame.NORMAL);
     }
   }
 }
 public void testContextIsJAppletWhenACompentInItHasFocus() {
   Frame frame = new Frame();
   JApplet applet = new JApplet();
   JButton button = new JButton();
   frame.add(applet);
   applet.getContentPane().add(button);
   setFocusManager(button);
   windowContext.propertyChange(new PropertyChangeEvent(this, "focusOwner", null, button));
   assertSame(applet, windowContext.activeWindow());
 }
Beispiel #9
0
 // set the frame on the center of bildschirm
 private static void setFrameCenter(Frame f, boolean flag) {
   // f.getToolkit();
   //	Dimension screen=f.getToolkit().getDefaultToolkit().getScreenSize();//获取屏幕尺寸对象
   Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); // 获取屏幕尺寸对象
   Dimension myframe = f.getSize(); // 获取当前窗体的尺寸对象
   int w = (screen.width - myframe.width) / 2; // 水平位置
   int h = (screen.height - myframe.width) / 2; // 垂直位置
   f.setLocation(w, h);
   f.setResizable(flag);
 }
Beispiel #10
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == b1) {
     Deletion form2 = new Deletion();
     f1.dispose();
   }
   if (e.getSource() == b2) {
     TestPat form = new TestPat();
     f1.dispose();
   }
 }
Beispiel #11
0
 /**
  * Centre the dialog box in the frame. This must be called after the size has been established,
  * i.e. after the buttons etc. are arranged and pack() is called
  */
 public void centreInFrame() {
   Dimension frame_size = parent.getSize();
   Point frame_location = parent.getLocation();
   int centre_x = frame_location.x + frame_size.width / 2;
   int centre_y = frame_location.y + frame_size.height / 2;
   ;
   int xloc = centre_x - this.getSize().width / 2;
   int yloc = centre_y - this.getSize().height / 2;
   this.setLocation(new Point(xloc, yloc));
   this.requestFocus();
 }
Beispiel #12
0
 public KeyOptionDialog(Frame parent) {
   this.setTitle("Keyboard Setting");
   this.setModal(true);
   this.setResizable(false);
   // this.setSize(230, 284);
   this.setBounds((int) parent.getX() + 20, (int) parent.getY() + 75, 230, 200);
   ls.setLanguage(gameconfigure.getLanguage());
   try {
     jbInit();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  private void restore() {
    Frame frame = getFrame();

    if (frame == null) {
      return;
    }

    if ((myState & Frame.ICONIFIED) != 0) {
      frame.setExtendedState(myState & ~Frame.ICONIFIED);
    } else {
      frame.setExtendedState(myState & ~Frame.MAXIMIZED_BOTH);
    }
  }
Beispiel #14
0
  public final void doExitApplication() {

    try {
      IGV.getInstance().saveStateForExit();

      Frame mainFrame = IGV.getMainFrame();
      // Hide and close the application
      mainFrame.setVisible(false);
      mainFrame.dispose();

    } finally {
      System.exit(0);
    }
  }
Beispiel #15
0
    public void actionPerformed(ActionEvent e) {
      Frame frame = getFrame();
      JFileChooser chooser = new JFileChooser();
      int ret = chooser.showSaveDialog(frame);

      if (ret != JFileChooser.APPROVE_OPTION) {
        return;
      }

      File f = chooser.getSelectedFile();
      frame.setTitle(f.getName());
      Thread saver = new FileSaver(f, editor.getDocument());
      saver.start();
    }
  /**
   * Updates LAF of all windows. The method also updates font of components as it's configured in
   * <code>UISettings</code>.
   */
  @Override
  public void updateUI() {
    final UIDefaults uiDefaults = UIManager.getLookAndFeelDefaults();

    fixPopupWeight();

    fixGtkPopupStyle();

    fixTreeWideSelection(uiDefaults);

    fixMenuIssues(uiDefaults);

    if (UIUtil.isUnderAquaLookAndFeel()) {
      uiDefaults.put("Panel.opaque", Boolean.TRUE);
    } else if (UIUtil.isWinLafOnVista()) {
      uiDefaults.put("ComboBox.border", null);
    }

    initInputMapDefaults(uiDefaults);

    uiDefaults.put("Button.defaultButtonFollowsFocus", Boolean.FALSE);

    patchFileChooserStrings(uiDefaults);

    patchLafFonts(uiDefaults);

    patchHiDPI(uiDefaults);

    patchGtkDefaults(uiDefaults);

    fixSeparatorColor(uiDefaults);

    updateToolWindows();

    for (Frame frame : Frame.getFrames()) {
      // OSX/Aqua fix: Some image caching components like ToolWindowHeader use
      // com.apple.laf.AquaNativeResources$CColorPaintUIResource
      // a Java wrapper for ObjC MagicBackgroundColor class (Java RGB values ignored).
      // MagicBackgroundColor always reports current Frame background.
      // So we need to set frames background to exact and correct value.
      if (SystemInfo.isMac) {
        //noinspection UseJBColor
        frame.setBackground(new Color(UIUtil.getPanelBackground().getRGB()));
      }

      updateUI(frame);
    }
    fireLookAndFeelChanged();
  }
Beispiel #17
0
  private boolean existsOtherDialog() {
    Frame ancestor = (Frame) JOptionUtils.centeringComp().getTopLevelAncestor();
    Window[] ownedWindows = ancestor.getOwnedWindows();

    for (Window window : ownedWindows) {
      if (window instanceof Dialog && !(window == getStopDialog()) && !(window == getOwner())) {
        Dialog dialog = (Dialog) window;
        if (dialog.isVisible()) {
          return true;
        }
      }
    }

    return false;
  }
  /**
   * Updates LAF of all windows. The method also updates font of components as it's configured in
   * <code>UISettings</code>.
   */
  @Override
  public void updateUI() {
    final UIDefaults uiDefaults = UIManager.getLookAndFeelDefaults();

    fixPopupWeight();

    fixGtkPopupStyle();

    fixTreeWideSelection(uiDefaults);

    fixMenuIssues(uiDefaults);

    if (UIUtil.isUnderAquaLookAndFeel()) {
      uiDefaults.put("Panel.opaque", Boolean.TRUE);
    } else if (UIUtil.isWinLafOnVista()) {
      uiDefaults.put("ComboBox.border", null);
    }

    initInputMapDefaults(uiDefaults);

    uiDefaults.put("Button.defaultButtonFollowsFocus", Boolean.FALSE);

    patchFileChooserStrings(uiDefaults);

    patchLafFonts(uiDefaults);

    patchOptionPaneIcons(uiDefaults);

    fixSeparatorColor(uiDefaults);

    for (Frame frame : Frame.getFrames()) {
      updateUI(frame);
    }
    fireLookAndFeelChanged();
  }
 public void dispose(boolean toDispose) {
   if (toDispose) {
     super.dispose();
     frame.toFront();
   }
   if (client != null) client.dialogDismissed(this);
 }
  public SplitPane(
      Frame aFrame,
      ProgressBarPanel aProgressBar,
      MessageTable aMessageTable,
      MessageTree aMessageTree,
      JTabbedPane aUpperTabbedPane,
      JTabbedPane aLowerTabbedPane,
      DefaultDataDictionaryAccess aDataDictionary) {
    super(JSplitPane.VERTICAL_SPLIT, aUpperTabbedPane, aLowerTabbedPane);

    frame = aFrame;
    menuBar = (MenuBar) aFrame.getJMenuBar();
    progressBar = aProgressBar;
    messageTable = aMessageTable;
    messageTree = aMessageTree;
    messageTree.setModel(null);
    upperTabbedPane = aUpperTabbedPane;
    dataDictionary = aDataDictionary;

    aLowerTabbedPane.add("Grid", new JScrollPane(messageTable));
    aLowerTabbedPane.add("Tree", new JScrollPane(messageTree));
    aUpperTabbedPane.addChangeListener(this);
    messageTable.addMouseListener(this);
    messageTree.addMouseListener(this);

    tracer =
        new Timer(
            5000,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                traceFile();
              }
            });
  }
 /** Repaints all displayable window. */
 @Override
 public void repaintUI() {
   Frame[] frames = Frame.getFrames();
   for (Frame frame : frames) {
     repaintUI(frame);
   }
 }
  public void stateChanged(ChangeEvent e) {
    JScrollPane scrollPane = ((JScrollPane) upperTabbedPane.getSelectedComponent());
    frame.fileLoaded(scrollPane != null);
    if (scrollPane == null) return;

    currentTable = (MessagesTable) scrollPane.getViewport().getView();
    currentModel = (MessagesTableModel) currentTable.getModel();
    menuBar.setSelectedFilter(currentModel.getFilterType());
  }
 public void init() {
   horizontal.add(new Button("水平按钮一"));
   horizontal.add(Box.createHorizontalGlue());
   horizontal.add(new Button("水平按钮二"));
   // 水平方向不可拉伸的间距,其宽度为10px
   horizontal.add(Box.createHorizontalStrut(10));
   horizontal.add(new Button("水平按钮三"));
   vertical.add(new Button("垂直按钮一"));
   vertical.add(Box.createVerticalGlue());
   vertical.add(new Button("垂直按钮二"));
   // 垂直方向不可拉伸的间距,其高度为10px
   vertical.add(Box.createVerticalStrut(10));
   vertical.add(new Button("垂直按钮三"));
   f.add(horizontal, BorderLayout.NORTH);
   f.add(vertical);
   f.pack();
   f.setVisible(true);
 }
Beispiel #24
0
  public MailDialog(Frame owner, String title, boolean modal) {
    super(owner, title, modal);

    Point p = owner.getLocation();
    this.setLocation(p.x + 50, p.y + 50);

    strings = ResourceBundle.getBundle("org.pegadi.maildialog.MailDialogStrings");

    createUI();
  }
    public void mousePressed(MouseEvent ev) {
      JRootPane rootPane = getRootPane();

      if (rootPane.getWindowDecorationStyle() == JRootPane.NONE) {
        return;
      }
      Point dragWindowOffset = ev.getPoint();
      Window w = (Window) ev.getSource();
      if (w != null) {
        w.toFront();
      }
      Point convertedDragWindowOffset =
          SwingUtilities.convertPoint(w, dragWindowOffset, getTitlePane());

      Frame f = null;
      Dialog d = null;

      if (w instanceof Frame) {
        f = (Frame) w;
      } else if (w instanceof Dialog) {
        d = (Dialog) w;
      }

      int frameState = (f != null) ? f.getExtendedState() : 0;

      if (getTitlePane() != null && getTitlePane().contains(convertedDragWindowOffset)) {
        if ((f != null && ((frameState & Frame.MAXIMIZED_BOTH) == 0) || (d != null))
            && dragWindowOffset.y >= BORDER_DRAG_THICKNESS
            && dragWindowOffset.x >= BORDER_DRAG_THICKNESS
            && dragWindowOffset.x < w.getWidth() - BORDER_DRAG_THICKNESS) {
          isMovingWindow = true;
          dragOffsetX = dragWindowOffset.x;
          dragOffsetY = dragWindowOffset.y;
        }
      } else if (f != null && f.isResizable() && ((frameState & Frame.MAXIMIZED_BOTH) == 0)
          || (d != null && d.isResizable())) {
        dragOffsetX = dragWindowOffset.x;
        dragOffsetY = dragWindowOffset.y;
        dragWidth = w.getWidth();
        dragHeight = w.getHeight();
        dragCursor = getCursor(calculateCorner(w, dragWindowOffset.x, dragWindowOffset.y));
      }
    }
Beispiel #26
0
 private ArrayList<Cell> enemyCells() {
   ArrayList<Cell> enemyCells = new ArrayList<>();
   for (Cell c : Frame.getInstance().getBoard().getCells()) {
     if (c.hasToken())
       if (c.getTok().getOwner() != this) {
         enemyCells.add(c);
       }
   }
   return enemyCells;
 }
Beispiel #27
0
 public void dispose() {
   f.dispose();
   f = null;
   dummy.dispose();
   dummy = null;
   if (modal_d != null) {
     modal_d.dispose();
     modal_d = null;
   }
 }
 /** Updates the UIs of all the known Frames. */
 private static void updateAllUIs() {
   // Check if the current UI is WindowsLookAndfeel and flush the XP style map.
   // Note: Change the package test if this class is moved to a different package.
   Class uiClass = UIManager.getLookAndFeel().getClass();
   if (uiClass.getPackage().equals(DesktopProperty.class.getPackage())) {
     XPStyle.invalidateStyle();
   }
   Frame appFrames[] = Frame.getFrames();
   for (int j = 0; j < appFrames.length; j++) {
     updateWindowUI(appFrames[j]);
   }
 }
  // Color gre;
  Rules(String se) {
    email = se;
    conti = new Button("Continue");
    rules = new Button("ClicK Here For Rules");
    p1 = new JOptionPane();
    Icon image = new ImageIcon("books.jpg");
    Icon image1 = new ImageIcon("girl.jpg");
    Icon image2 = new ImageIcon("uit.jpg");
    gl = new GridBagLayout();
    gbc = new GridBagConstraints();
    conti.addActionListener(this);
    rules.addActionListener(this);
    // gre=new Color(117,102,185);
    p = new Panel();
    p2 = new Panel();
    p3 = new Panel();
    p4 = new Panel();
    f = new Frame();
    pic = new JLabel(image);
    pic1 = new JLabel(image1);
    pic2 = new JLabel(image2);
    gbc.anchor = GridBagConstraints.SOUTHWEST;
    gl.setConstraints(pic1, gbc);
    gbc.anchor = GridBagConstraints.SOUTHEAST;
    gl.setConstraints(pic, gbc);
    Insets is = new Insets(30, 30, 30, 30);
    gbc.insets = is;
    gbc.ipadx = 14;
    gbc.ipady = 8;
    gl.setConstraints(rules, gbc);
    gl.setConstraints(conti, gbc);
    p2.setLayout(gl);
    p4.add(pic2);
    p2.add(pic);
    p3.setLayout(gl);
    p3.add(pic1);
    p.add(conti);
    p.add(rules);
    p.setLayout(gl);
    f.add(p4, "North");
    f.add(p3, "East");
    f.add(p2, "West");

    f.add(p, "Center");
    f.setTitle("RULES BOOK");
    // f.setBackground(gre);
    f.setVisible(true);
    f.setSize(900, 600);
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {
            System.exit(0);
          }
        });
  }
Beispiel #30
0
 public void init() {
   Panel p = new Panel();
   p.add(btCopy);
   p.add(btPaste);
   btCopy.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent event) {
           // 将一个多行文本域里的字符串封装成StringSelection对象
           StringSelection contents = new StringSelection(jtaCopyTo.getText());
           // 将StringSelection对象放入剪贴板
           clipboard.setContents(contents, null);
         }
       });
   btPaste.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent event) {
           // 如果剪贴板中包含stringFlavor内容
           if (clipboard.isDataFlavorAvailable(DataFlavor.stringFlavor)) {
             try {
               // 取出剪贴板中stringFlavor内容
               String content = (String) clipboard.getData(DataFlavor.stringFlavor);
               jtaPaste.append(content);
             } catch (Exception e) {
               e.printStackTrace();
             }
           }
         }
       });
   // 创建一个水平排列的Box容器
   Box box = new Box(BoxLayout.X_AXIS);
   // 将两个多行文本域放在Box容器中
   box.add(jtaCopyTo);
   box.add(jtaPaste);
   // 将按钮所在Panel、Box容器添加到Frame窗口中
   f.add(p, BorderLayout.SOUTH);
   f.add(box, BorderLayout.CENTER);
   f.pack();
   f.setVisible(true);
 }