public HDMColdAccountForm(final WalletListPanel walletListPanel) {
    this.walletListPanel = walletListPanel;

    inactiveBackGroundColor = Color.WHITE;
    selected = false;
    panelMain.setOpaque(true);
    panelMain.setFocusable(true);
    panelMain.setBackground(inactiveBackGroundColor);

    if (ColorAndFontConstants.isInverse()) {
      inactiveBackGroundColor =
          new Color(
              Math.min(255, Themes.currentTheme.detailPanelBackground().getRed() + 2 * COLOR_DELTA),
              Math.min(
                  255, Themes.currentTheme.detailPanelBackground().getBlue() + 2 * COLOR_DELTA),
              Math.min(
                  255, Themes.currentTheme.detailPanelBackground().getGreen() + 2 * COLOR_DELTA));
    } else {
      inactiveBackGroundColor =
          new Color(
              Math.max(0, Themes.currentTheme.detailPanelBackground().getRed() - COLOR_DELTA),
              Math.max(0, Themes.currentTheme.detailPanelBackground().getBlue() - COLOR_DELTA),
              Math.max(0, Themes.currentTheme.detailPanelBackground().getGreen() - COLOR_DELTA));
    }
    panelMain.applyComponentOrientation(
        ComponentOrientation.getOrientation(LocaliserUtils.getLocale()));

    updateFromModel();
    panelMain.addMouseListener(
        new WalletMouseListener(this.walletListPanel, HDMColdAccountForm.this));

    setSelected(false);
    setContent();
  }
  private JPanel createContentPane() {
    JPanel panel = new JPanel();

    combo1 = new JComboBox<>(numData);
    panel.add(combo1);
    combo2 = new JComboBox<>(dayData);
    combo2.setEditable(true);
    panel.add(combo2);
    panel.setSize(300, 200);

    popupMenu = new JPopupMenu();
    JMenuItem item;
    for (int i = 0; i < dayData.length; i++) {
      item = popupMenu.add(new JMenuItem(dayData[i], mnDayData[i]));
      item.addActionListener(this);
    }
    panel.addMouseListener(new PopupListener(popupMenu));

    JTextField field = new JTextField("CTRL+down for Popup");
    // CTRL-down will show the popup.
    field
        .getInputMap()
        .put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_MASK), "OPEN_POPUP");
    field.getActionMap().put("OPEN_POPUP", new PopupHandler());

    panel.add(field);

    return panel;
  }
  /** Create the custom ui components. */
  private void createUIComponents() {
    root = new JPanel();
    top = new JPanel();
    right = new JPanel();
    properties = new JPanel();
    propertiesRoot = new JPanel();
    network = new NetworkPanel();
    network.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent mouseEvent) {}

          public void mousePressed(MouseEvent mouseEvent) {

            selectedNode =
                NetworkImage.peekNearest(
                    (int) network.getSize().getWidth(),
                    (int) network.getSize().getHeight(),
                    mouseEvent.getX(),
                    mouseEvent.getY(),
                    epanetNetwork);
            network.repaint();
          }

          public void mouseReleased(MouseEvent mouseEvent) {}

          public void mouseEntered(MouseEvent mouseEvent) {}

          public void mouseExited(MouseEvent mouseEvent) {}
        });
  }
示例#4
0
  public Clock() {

    main_panel.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent e) {
            System.exit(0);
          }
        });

    Timer timer =
        new Timer(
            1000,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                Calendar curTime = Calendar.getInstance();
                curTime.setTimeInMillis(System.currentTimeMillis());

                hour.setText(setTimeString(curTime.get(Calendar.HOUR_OF_DAY) + ""));
                minutes.setText(setTimeString(curTime.get(Calendar.MINUTE) + ""));
                second.setText(setTimeString(curTime.get(Calendar.SECOND) + ""));
              }
            });
    timer.setInitialDelay(0);
    timer.start();
  }
  /**
   * Creates the panel that appears when there are no pages
   *
   * @return JPanel
   */
  protected JPanel createFirstPanel() {
    firstButtonPanel = new JPanel(new GridBagLayout());
    firstButtonPanel.setBorder(BorderFactory.createLineBorder(Color.black));
    firstButtonPanel.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent _evt) {
            if (OSPRuntime.isPopupTrigger(_evt))
              return; // SwingUtilities.isRightMouseButton(_evt)) return;
            if (!firstButtonPanel.isEnabled()) return;
            Object obj =
                JOptionPane.showInputDialog(
                    getComponent(),
                    res.getString("TabbedEditor.NewName"),
                    res.getString("TabbedEditor.Rename"),
                    JOptionPane.QUESTION_MESSAGE,
                    null,
                    null,
                    getUniqueName(defaultString));
            if (obj == null) return;
            String txt = obj.toString().trim();
            if (txt.length() > 0) addPage(defaultType, txt, null, true);
            else addPage(defaultType, defaultString, null, true);
          }
        });
    String label = res.getOptionalString("TabbedEditor.ClickHere." + defaultHeader);
    if (label == null) label = res.getString("TabbedEditor.ClickHere");
    firstButton = new JLabel(label);
    firstButton.setFont(firstButton.getFont().deriveFont(TabbedEditor.BUTTON_FONT_SIZE));
    firstButtonPanel.add(firstButton);

    JPanel firstPanel = new JPanel(new GridLayout(0, 1));
    firstPanel.add(firstButtonPanel);
    return firstPanel;
  }
 /**
  * Constructs an OSPControl.
  *
  * @param _model
  */
 public OSPControl(Object _model) {
   super(ControlsRes.getString("OSPControl.Default_Title")); // $NON-NLS-1$
   model = _model;
   if (model != null) {
     // added by D Brown 2006-09-10
     // modified by D Brown 2007-10-17
     if (OSPRuntime.translator != null) OSPRuntime.translator.associate(this, model.getClass());
     String name = model.getClass().getName();
     setTitle(
         name.substring(1 + name.lastIndexOf("."))
             + ControlsRes.getString("OSPControl.Controller")); // $NON-NLS-1$ //$NON-NLS-2$
   }
   ToolsRes.addPropertyChangeListener("locale", this);
   Font labelFont = new Font("Dialog", Font.BOLD, 12); // $NON-NLS-1$
   inputLabel =
       new JLabel(
           ControlsRes.getString("OSPControl.Input_Parameters"),
           SwingConstants.CENTER); // $NON-NLS-1$
   inputLabel.setFont(labelFont);
   messageTextArea = new JTextArea(5, 5);
   JScrollPane messageScrollPane = new JScrollPane(messageTextArea);
   // contains a view of the control
   JPanel topPanel = new JPanel(new BorderLayout());
   topPanel.add(inputLabel, BorderLayout.NORTH);
   topPanel.add(controlScrollPane, BorderLayout.CENTER);
   buttonPanel.setVisible(true);
   topPanel.add(buttonPanel, BorderLayout.SOUTH); // buttons are added using addButton method.
   // clear panel acts like a button to clear the message area
   JPanel clearPanel = new JPanel(new BorderLayout());
   clearPanel.addMouseListener(new ClearMouseAdapter());
   clearLabel = new JLabel(ControlsRes.getString("OSPControl.Clear")); // $NON-NLS-1$
   clearLabel.setFont(new Font(clearLabel.getFont().getFamily(), Font.PLAIN, 9));
   clearLabel.setForeground(Color.black);
   clearPanel.add(clearLabel, BorderLayout.WEST);
   // contains the messages
   JPanel bottomPanel = new JPanel(new BorderLayout());
   messageLabel =
       new JLabel(
           ControlsRes.getString("OSPControl.Messages"), SwingConstants.CENTER); // $NON-NLS-1$
   messageLabel.setFont(labelFont);
   bottomPanel.add(messageLabel, BorderLayout.NORTH);
   bottomPanel.add(messageScrollPane, BorderLayout.CENTER);
   bottomPanel.add(clearPanel, BorderLayout.SOUTH);
   Container cp = getContentPane();
   splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, bottomPanel);
   splitPane.setOneTouchExpandable(true);
   cp.add(splitPane, BorderLayout.CENTER);
   messageTextArea.setEditable(false);
   controlScrollPane.setPreferredSize(new Dimension(350, 200));
   controlScrollPane.setMinimumSize(new Dimension(0, 50));
   messageScrollPane.setPreferredSize(new Dimension(350, 75));
   if (OSPRuntime.translator != null && model != null) {
     OSPRuntime.translator.associate(table, model.getClass());
   }
   Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
   setLocation(
       (d.width - getSize().width) / 2, (d.height - getSize().height) / 2); // center the frame
   init();
 }
  CommandPanel(Commande c) {
    super(new BorderLayout());
    commande = c;
    commande.addActionEventListener(this);

    JPanel text = new JPanel();
    text.addMouseListener(this);
    text.add(new JLabel(commande.getName()));
    add(text, BorderLayout.PAGE_START);

    itemList = new JPanel(new GridBagLayout());
    itemList.addMouseListener(this);
    itemList.setBackground(Color.WHITE);

    JScrollPane pane = new JScrollPane(itemList);
    pane.setPreferredSize(new Dimension(95, 100));
    add(pane, BorderLayout.CENTER);
    drawItems();
  }
  protected void setup(
      final AnAction action,
      JPanel root,
      final JLabel name,
      final JLabel description,
      JLabel icon) {
    name.setText(action.getTemplatePresentation().getText());
    name.setUI(DarculaWelcomeScreenLabelUI.createUI(name));
    name.setForeground(UIUtil.getPanelBackground());
    description.setUI(DarculaWelcomeScreenLabelUI.createUI(description));
    // icon.setIcon(action.getTemplatePresentation().getIcon());
    final String text = action.getTemplatePresentation().getDescription();
    final String html =
        XmlStringUtil.wrapInHtml(
            MessageFormat.format(text, ApplicationNamesInfo.getInstance().getFullProductName()));
    root.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    description.setText(html);
    description.setForeground(Gray._200);
    description.setEnabled(false);
    root.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseEntered(MouseEvent e) {
            description.setEnabled(true);
            name.setForeground(new Color(0xE09600));
          }

          @Override
          public void mouseExited(MouseEvent e) {
            description.setEnabled(false);
            name.setForeground(UIUtil.getPanelBackground());
          }

          @Override
          public void mouseClicked(MouseEvent e) {
            final ActionManager actionManager = ActionManager.getInstance();
            AnActionEvent evt =
                new AnActionEvent(
                    null,
                    DataManager.getInstance().getDataContext(e.getComponent()),
                    ActionPlaces.WELCOME_SCREEN,
                    action.getTemplatePresentation(),
                    actionManager,
                    0);
            action.beforeActionPerformedUpdate(evt);
            if (evt.getPresentation().isEnabled()) {
              action.actionPerformed(evt);
            }
          }
        });
  }
  public CategoryPanel(
      String name, List<ResourceLocator> locatorList, Set<String> loadedTrackNames) {

    expanded = true;

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setAlignmentX(LEFT_ALIGNMENT);
    // setLayout(null);

    labelBar = new JPanel();
    // labelBar.setBackground(Color.blue);
    labelBar.setLayout(new BoxLayout(labelBar, BoxLayout.X_AXIS));
    labelBar.setBorder(BorderFactory.createRaisedBevelBorder()); //  new LabelBorder(Color.black));
    labelBar.setAlignmentX(LEFT_ALIGNMENT);
    JideButton toggleButton = new JideButton(expanded ? " - " : " + ");
    toggleButton.setButtonStyle(ButtonStyle.HYPERLINK_STYLE);
    labelBar.add(toggleButton);

    labelBar.add(new JLabel(name));
    this.add(labelBar);

    listPanel = new JPanel();
    listPanel.setLayout(new GridLayout(0, 4));
    for (ResourceLocator loc : locatorList) {
      final String trackName = loc.getTrackName();
      JCheckBox cb = new JCheckBox(trackName);
      cb.setSelected(loadedTrackNames.contains(trackName));
      listPanel.add(cb);
    }
    this.add(listPanel);

    toggleButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            expanded = !expanded;
            listPanel.setVisible(expanded);
          }
        });
    labelBar.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent mouseEvent) {
            expanded = !expanded;
            listPanel.setVisible(expanded);
          }
        });
  }
示例#10
0
  public static void main(String[] s) {
    JFrame frame = new JFrame("A test frame");
    JPanel outputBox = new JPanel();
    JButton jButton = new JButton();

    frame.setSize(200, 200);
    frame.addMouseWheelListener(
        new MouseWheelListener() {
          public void mouseWheelMoved(MouseWheelEvent e) {
            System.out.println("Wheel moved on FRAME : " + e);
            actualEvents++;
          }
        });

    outputBox.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent e) {
            System.out.println("MousePressed on OUTBOX : " + e);
          }
        });
    frame.add(outputBox);
    outputBox.add(jButton);

    frame.setVisible(true);

    Util.waitForIdle(robot);

    Util.pointOnComp(jButton, robot);
    Util.waitForIdle(robot);

    for (int i = 0; i < MOVE_COUNT; i++) {
      robot.mouseWheel(1);
      robot.delay(10);
    }

    for (int i = 0; i < MOVE_COUNT; i++) {
      robot.mouseWheel(-1);
      robot.delay(10);
    }

    Util.waitForIdle(robot);
    // Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
    // result in a single wheel rotation.
    if (actualEvents != EXPECTED_COUNT) {
      AbstractTest.fail(
          "Expected events count: " + EXPECTED_COUNT + " Actual events count: " + actualEvents);
    }
  }
示例#11
0
文件: InGame.java 项目: eR3tbvK/1.96
  public void chat(JPanel panel) {
    this.panel = panel;
    userInterface = new UI(player);
    userInterface.chat(panel);

    AddKeyListener keyListener = new AddKeyListener();
    keyListener.setPlayer(player);

    keyListenerLayer = new JLayeredPane();
    keyListenerLayer.add(keyListener, 10);

    panel.add(BorderLayout.CENTER, keyListenerLayer);
    keyListener.setFocusable(true);
    keyListener.requestFocusInWindow();

    panel.add(BorderLayout.CENTER, layeredPane);
    panel.add(BorderLayout.SOUTH, userInterface.getChatPanel());
    panel.validate();
    panel.repaint();

    // initialize
    networkStartup.InGameChatInitialize(userInterface.getOutgoing(), userInterface.getIncoming());

    panel.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent e) {
            keyListener.setFocusable(true);
            keyListener.requestFocusInWindow();
          }
        });

    userInterface
        .getOutgoing()
        .addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                networkStartup.InGameChatSendButtonListener(
                    userInterface.getOutgoing(), userInterface.getIncoming());
              }
            });

    // startDrawingPanelThread();

  }
示例#12
0
 public void addRow(Component... components) {
   remove(puff);
   final JPanel row = new JPanel();
   row.addMouseListener(
       new MouseAdapter() {
         @Override
         public void mouseClicked(MouseEvent event) {
           gui.notifyObserver("/use " + rows.indexOf(event.getSource()));
         }
       });
   row.setLayout(new BoxLayout(row, BoxLayout.X_AXIS));
   // row.add(Box.createHorizontalStrut(3));
   row.setMinimumSize(new Dimension(10, 30));
   row.setMaximumSize(new Dimension(250, 30));
   for (Component component : components) {
     row.add(component);
   }
   JButton red = new JButton("x");
   red.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent event) {
           int deleted = rows.indexOf(row);
           gui.notifyObserver("/use " + deleted);
           gui.notifyObserver("/disconnect");
         }
       });
   red.setBackground(Color.PINK.darker());
   red.setForeground(Color.WHITE);
   row.add(Box.createHorizontalGlue());
   row.add(red);
   rows.add(row);
   Component strut = Box.createVerticalStrut(5);
   struts.add(strut);
   add(row);
   add(strut);
   add(puff);
   repaint();
   updateUI();
 }
示例#13
0
  public void init(Object parent) {

    glass = new BlurGlass();
    glass.setLayout(null);

    this.setLayout(null);

    setOpaque(false);
    // getContentPane().setOpaque(false);
    this.getLayeredPane().setOpaque(false);
    this.getRootPane().setOpaque(false);
    // putClientProperty("Synthetica.opaque", Boolean.FALSE);

    JParent = parent;
    glass.setOpaque(false);

    MouseInputAdapter adapter = new MouseInputAdapter() {};
    glass.addMouseListener(adapter);
    glass.addMouseMotionListener(adapter);

    try {
      if (parent instanceof JFrame) {
        layer = ((JFrame) parent).getLayeredPane();
      } else if (parent instanceof JInternalFrame) {
        layer = ((JInternalFrame) parent).getLayeredPane();
      }
      glass.setBounds(layer.getBounds());

    } catch (NullPointerException err) {
      Dialogos.error("Error interno en Dialogo interno modal", err);
    }

    try {
      glass.add(this);
      layer.add(glass, JLayeredPane.DEFAULT_LAYER);
    } catch (NullPointerException err) {
      Dialogos.error("Error interno en dialogo modal interno", err);
    }
  }
示例#14
0
  /** untuk menjalankan ini harus sudah build label dan build form */
  public void buildPanel() {
    panel = new JPanel(new BorderLayout());
    panelForm = builder.getPanel();

    panelForm.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
              if (master != null) {
                if (master.isPerspectiveDefault()) {
                  if (typeEfectWidget == WIDGET_1) {
                    master.perspective1();
                  } else if (typeEfectWidget == WIDGET_2) {
                    master.perspective2();
                  } else if (typeEfectWidget == WIDGET_3) {
                    master.perspective3();
                  } else if (typeEfectWidget == WIDGET_4) {
                    master.perspective4();
                  }
                } else {
                  master.perspectiveDefault();
                }
              } else {
                App.showErrSementara("Master null");
              }
            }
          }

          public void mouseReleased(MouseEvent e) {}
        });

    pane = new JScrollPane(panelForm);

    pane.setBorder(BorderFactory.createLineBorder(Color.WHITE));
    panel.add(pane, BorderLayout.CENTER);
    panel.add(label, BorderLayout.NORTH);
  }
示例#15
0
文件: SetMap.java 项目: kkmehra/SE
  public void makeFrame() throws IOException {

    panel =
        new JPanel() {
          public void paintComponent(Graphics g) {
            Graphics2D g2 = (Graphics2D) g;
            g2.setColor(Color.RED);
            if (bufImage == null) {
              int w = this.getWidth();
              int h = this.getHeight();
              bufImage = new BufferedImage(800, 500, BufferedImage.TRANSLUCENT);
              Graphics2D gc = bufImage.createGraphics();
            }

            g2.drawImage(bufImage, null, 0, 0);
            if (state == State.DRAGGING) {
              g2.drawLine(start.x, start.y, end.x, end.y);
            }
          }

          public Dimension getPreferredSize() {
            return new Dimension(1300, 800);
          }
        };

    panel.addMouseListener(
        new MouseListener() {
          @Override
          public void mouseClicked(MouseEvent e) {

            x = e.getX();
            y = e.getY();
            label = new JLabel();

            String name = JOptionPane.showInputDialog("Enter the name of City");

            if (name.equals("Jodhpur")) {
              ImageIcon img = new ImageIcon("jodhpur.jpg");
              label.setIcon(img);
            } else if (name.equals("Pali")) {
              ImageIcon img = new ImageIcon("pali.jpg");
              label.setIcon(img);

            } else if (name.equals("Mahendipur Balajee")) {
              ImageIcon img = new ImageIcon("Mahendipur Balijee.jpg");
              label.setIcon(img);

            } else if (name.equals("Nadoti")) {
              ImageIcon img = new ImageIcon("Nadoti.jpg");
              label.setIcon(img);
            } else if (name.equals("Jaipur")) {
              ImageIcon img = new ImageIcon("jaipur.jpg");
              label.setIcon(img);
            } else if (name.equals("Ratanada Headoffice")) {
              ImageIcon img = new ImageIcon("Ratanada.jpg");
              label.setIcon(img);
            } else {
              ImageIcon img = new ImageIcon("Other.jpg");
              label.setIcon(img);
            }

            label.setLayout(new BorderLayout());
            panel.add(label);

            label.setBounds(x, y, 65, 60);
            label.setToolTipText(name);
          }

          @Override
          public void mousePressed(MouseEvent me) {}

          @Override
          public void mouseReleased(MouseEvent me) {

            state = State.IDLE;
          }

          @Override
          public void mouseEntered(MouseEvent me) {}

          @Override
          public void mouseExited(MouseEvent me) {}
        });

    panel.addMouseMotionListener(
        new MouseMotionListener() {

          @Override
          public void mouseDragged(MouseEvent me) {
            state = State.DRAGGING;
            end = me.getPoint();
            if (state == State.DRAGGING) {
              Graphics2D g2 = bufImage.createGraphics();
              g2.setColor(Color.red);
              g2.setStroke(new BasicStroke(2));
              g2.drawLine(start.x, start.y, end.x, end.y);
              panel.repaint();
            }
            start = end;
          }

          @Override
          public void mouseMoved(MouseEvent me) {

            start = me.getPoint();
          }
        });

    panel.setOpaque(true);
    // ^ out.close();
  }
示例#16
0
  public Reflexology2() {
    frame.setSize(615, 455);
    frame.setLocationRelativeTo(null);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setTitle("Reflexology 2.0");
    frame.setResizable(false);

    frame2.setSize(600, 475);
    frame2.setLocationRelativeTo(null);
    frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame2.setTitle("Reflexology 2.0");
    frame2.setResizable(false);

    frame3.setSize(600, 475);
    frame3.setLocationRelativeTo(null);
    frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame3.setTitle("Reflexology Survey");
    frame3.setResizable(false);

    button1 = new JButton("Accept");
    button2 = new JButton("Decline");
    // movingButton = new JButton("Click Me");

    ListenForAcceptButton lForAButton = new ListenForAcceptButton();
    ListenForDeclineButton lForDButton = new ListenForDeclineButton();
    button1.addActionListener(lForAButton);
    button2.addActionListener(lForDButton);
    // movingButton.addActionListener(lForMButton);

    textArea1.setText("Tracking Events\n");
    textArea1.setLineWrap(true);
    textArea1.setWrapStyleWord(true);
    textArea1.setSize(15, 50);
    textArea1.setEditable(false);

    FileReader reader = null;
    try {
      reader = new FileReader("EULA.txt");
      textArea1.read(reader, "EULA.txt");
    } catch (IOException exception) {
      System.err.println("Problem loading file");
      exception.printStackTrace();
    } finally {
      if (reader != null) {
        try {
          reader.close();
        } catch (IOException exception) {
          System.err.println("Error closing reader");
          exception.printStackTrace();
        }
      }
    }

    AdjustmentListener sListener = new MyAdjustmentListener();
    scrollBar1.getVerticalScrollBar().addAdjustmentListener(sListener);

    thePanel.add(scrollBar1);
    button1.setEnabled(false);
    thePanel.add(button1);
    thePanel.add(button2);

    frame.add(thePanel);
    ListenForMouse lForMouse = new ListenForMouse();
    thePlacebo.addMouseListener(lForMouse);
    label1.setFont(font);
    thePlacebo.add(label1);
    frame2.add(thePlacebo);

    ListenForWindow lForWindow = new ListenForWindow();
    frame.addWindowListener(lForWindow);
    frame2.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (e.getKeyChar() == 'X' || e.getKeyChar() == 'x') {
              moveBallTimer.start();
            }
          }
        });
    frame.setVisible(true);

    moveBallTimer =
        new Timer(
            900,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                moveBall();
                //  System.out.println("Timer started!");
                repaint();
              }
            });

    addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (frame2.isVisible()) {
              moveBallTimer.start();
            }
          }
        });

    setFont(new Font("Tahoma", Font.PLAIN, 11));
    panelSurv1.setFont(new Font("Tahoma", Font.PLAIN, 11));
    frame3.getContentPane().setLayout(new CardLayout(0, 0));
    frame3.getContentPane().add(panelSurv1, "");
    panelSurv1.setLayout(null);

    /*
    frame3.setVisible(true);
    frame3.setSize(600, 475);
    frame3.setResizable(false);
    frame3.setLocationRelativeTo(null);
    frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    */

    JLabel lblNewLabel = new JLabel("How old are you?");
    lblNewLabel.setBounds(22, 26, 112, 14);
    panelSurv1.add(lblNewLabel);

    JLabel lblNewLabel_1 = new JLabel("Select your gender:");
    lblNewLabel_1.setBounds(366, 37, 115, 14);
    panelSurv1.add(lblNewLabel_1);

    JLabel lblNewLabel_2 = new JLabel("Current class level:");
    lblNewLabel_2.setBounds(22, 56, 112, 14);
    panelSurv1.add(lblNewLabel_2);

    String[] classLevel = {
      "", "Freshman", "Sophomore", "Junior", "Senior", "Senior+", "Graduate Student", "Other"
    };
    cmbClass = new JComboBox(classLevel);
    cmbClass.setName("");
    cmbClass.setBounds(144, 53, 195, 20);
    panelSurv1.add(cmbClass);

    JLabel lblWhatIsYour = new JLabel("What is your major or field?");
    lblWhatIsYour.setBounds(22, 102, 161, 14);
    panelSurv1.add(lblWhatIsYour);

    txtMajor = new JTextField();
    txtMajor.setName("");
    txtMajor.setColumns(10);
    txtMajor.setBounds(193, 99, 347, 20);
    panelSurv1.add(txtMajor);

    JLabel lblDidYouRead =
        new JLabel("Did you read the license agreement before installing Reflexology?");
    lblDidYouRead.setBounds(22, 143, 392, 14);
    panelSurv1.add(lblDidYouRead);

    JLabel lblIfTheLicensing =
        new JLabel(
            "If the licensing agreement raised any privacy concerns, please type them below:");
    lblIfTheLicensing.setBounds(22, 178, 503, 14);
    panelSurv1.add(lblIfTheLicensing);

    JLabel lblToHowMany = new JLabel("Up to how many friends may you gift Reflexology?");
    lblToHowMany.setBounds(22, 247, 303, 14);
    panelSurv1.add(lblToHowMany);

    String[] numGifts = {"", "Don't know", "0", "1", "2", "3", "4"};
    cmbNumGifts = new JComboBox(numGifts);
    cmbNumGifts.setBounds(320, 244, 205, 20);
    panelSurv1.add(cmbNumGifts);

    JLabel lblReflexologyProvidesThe = new JLabel("Reflexology provides the following warranty:");
    lblReflexologyProvidesThe.setBounds(22, 280, 254, 14);
    panelSurv1.add(lblReflexologyProvidesThe);

    String[] theWarranty = {
      "",
      "Don't know",
      "Won't harm my computer",
      "Doesn't have viruses",
      "Money back guarantee",
      "None"
    };
    cmbWarranty = new JComboBox(theWarranty);
    cmbWarranty.setBounds(296, 277, 157, 20);
    panelSurv1.add(cmbWarranty);

    JLabel lblWhoOwnsIntellectual =
        new JLabel("Who owns intellectual property created with Reflexology?");
    lblWhoOwnsIntellectual.setBounds(22, 316, 372, 14);
    panelSurv1.add(lblWhoOwnsIntellectual);

    String[] IPOwner = {
      "", "Don't know", "Me", "The researchers", "Penn State", "Reflexology programmers"
    };
    cmbIPOwner = new JComboBox(IPOwner);
    cmbIPOwner.setBounds(408, 313, 157, 20);
    panelSurv1.add(cmbIPOwner);

    btnPage2.setBounds(340, 400, 89, 23);
    panelSurv1.add(btnPage2);

    JLabel lblNewLabel_3 = new JLabel("*WARNING* You cannot return to these answers.");
    lblNewLabel_3.setForeground(Color.RED);
    lblNewLabel_3.setBounds(35, 404, 277, 14);
    panelSurv1.add(lblNewLabel_3);

    String[] gender = {"", "M", "F"};
    cmbGender = new JComboBox(gender);
    cmbGender.setBounds(491, 34, 70, 20);
    panelSurv1.add(cmbGender);

    String[] didRead = {"", "Yes", "No"};
    cmbDidRead = new JComboBox(didRead);
    cmbDidRead.setBounds(424, 140, 98, 20);
    panelSurv1.add(cmbDidRead);

    spnAge = new JSpinner();
    spnAge.setModel(new SpinnerNumberModel(1, 1, 111, 1));
    spnAge.setBounds(148, 23, 47, 20);
    panelSurv1.add(spnAge);

    txtPrivacyConcerns = new JTextField();
    txtPrivacyConcerns.setName("");
    txtPrivacyConcerns.setColumns(10);
    txtPrivacyConcerns.setBounds(22, 204, 547, 23);
    panelSurv1.add(txtPrivacyConcerns);

    frame3.getContentPane().add(panelSurv2, "");
    panelSurv2.setLayout(null);

    JLabel lblNewLabel_4 =
        new JLabel("Estimate your overall comprehension of the License Agreement:");
    lblNewLabel_4.setBounds(20, 18, 386, 14);
    panelSurv2.add(lblNewLabel_4);

    sldComp = new JSlider();
    sldComp.setMajorTickSpacing(1);
    sldComp.setPaintTicks(true);
    sldComp.setPaintLabels(true);
    sldComp.setSnapToTicks(true);
    sldComp.setValue(-1);
    sldComp.setMinorTickSpacing(1);
    sldComp.setMinimum(1);
    sldComp.setMaximum(5);
    sldComp.setBounds(154, 43, 274, 45);
    panelSurv2.add(sldComp);

    JLabel lblNewLabel_5 = new JLabel("No comprehension");
    lblNewLabel_5.setHorizontalAlignment(SwingConstants.RIGHT);
    lblNewLabel_5.setBounds(20, 43, 124, 25);
    panelSurv2.add(lblNewLabel_5);

    JLabel lblNewLabel_6 = new JLabel("Perfect Comprehension");
    lblNewLabel_6.setBounds(438, 43, 138, 25);
    panelSurv2.add(lblNewLabel_6);

    JLabel lblIEnjoyUsing = new JLabel("I enjoy using technological applications (apps):");
    lblIEnjoyUsing.setBounds(20, 99, 386, 14);
    panelSurv2.add(lblIEnjoyUsing);

    JLabel lblStronglyDisagree = new JLabel("Strongly disagree");
    lblStronglyDisagree.setHorizontalAlignment(SwingConstants.RIGHT);
    lblStronglyDisagree.setBounds(20, 124, 124, 25);
    panelSurv2.add(lblStronglyDisagree);

    sldEnjoyTech = new JSlider();
    sldEnjoyTech.setValue(-1);
    sldEnjoyTech.setSnapToTicks(true);
    sldEnjoyTech.setPaintTicks(true);
    sldEnjoyTech.setPaintLabels(true);
    sldEnjoyTech.setMinorTickSpacing(1);
    sldEnjoyTech.setMinimum(1);
    sldEnjoyTech.setMaximum(5);
    sldEnjoyTech.setMajorTickSpacing(1);
    sldEnjoyTech.setBounds(154, 124, 274, 45);
    panelSurv2.add(sldEnjoyTech);

    JLabel lblStronglyAgree = new JLabel("Strongly agree");
    lblStronglyAgree.setBounds(438, 124, 138, 25);
    panelSurv2.add(lblStronglyAgree);

    JLabel lblIAmGood = new JLabel("I am good at using technological applications (apps):");
    lblIAmGood.setBounds(20, 180, 386, 14);
    panelSurv2.add(lblIAmGood);

    sldUseTech = new JSlider();
    sldUseTech.setValue(-1);
    sldUseTech.setSnapToTicks(true);
    sldUseTech.setPaintTicks(true);
    sldUseTech.setPaintLabels(true);
    sldUseTech.setMinorTickSpacing(1);
    sldUseTech.setMinimum(1);
    sldUseTech.setMaximum(5);
    sldUseTech.setMajorTickSpacing(1);
    sldUseTech.setBounds(154, 205, 274, 45);
    panelSurv2.add(sldUseTech);

    JLabel lblHowOftenDo = new JLabel("My friends ask me for computer and technology advice:");
    lblHowOftenDo.setBounds(20, 261, 386, 14);
    panelSurv2.add(lblHowOftenDo);

    sldFriendsTech = new JSlider();
    sldFriendsTech.setValue(-1);
    sldFriendsTech.setSnapToTicks(true);
    sldFriendsTech.setPaintTicks(true);
    sldFriendsTech.setPaintLabels(true);
    sldFriendsTech.setMinorTickSpacing(1);
    sldFriendsTech.setMinimum(1);
    sldFriendsTech.setMaximum(5);
    sldFriendsTech.setMajorTickSpacing(1);
    sldFriendsTech.setBounds(154, 286, 274, 45);
    panelSurv2.add(sldFriendsTech);

    JLabel label_1 = new JLabel("Strongly disagree");
    label_1.setHorizontalAlignment(SwingConstants.RIGHT);
    label_1.setBounds(20, 205, 124, 25);
    panelSurv2.add(label_1);

    JLabel label_2 = new JLabel("Strongly disagree");
    label_2.setHorizontalAlignment(SwingConstants.RIGHT);
    label_2.setBounds(20, 286, 124, 25);
    panelSurv2.add(label_2);

    JLabel label_3 = new JLabel("Strongly agree");
    label_3.setBounds(438, 205, 138, 25);
    panelSurv2.add(label_3);

    JLabel label_4 = new JLabel("Strongly agree");
    label_4.setBounds(438, 286, 138, 25);
    panelSurv2.add(label_4);

    JLabel label_5 = new JLabel("*WARNING* You cannot return to these answers.");
    label_5.setForeground(Color.RED);
    label_5.setBounds(80, 382, 277, 14);
    panelSurv2.add(label_5);

    btnPage3.setBounds(385, 378, 89, 23);
    panelSurv2.add(btnPage3);

    frame3.getContentPane().add(panelSurv3, "");
    panelSurv3.setLayout(null);

    JLabel lblNewLabel_7 = new JLabel("Is there anything you enjoyed about the license agreement?");
    lblNewLabel_7.setBounds(10, 11, 349, 14);
    panelSurv3.add(lblNewLabel_7);

    txtEnjoyedLic = new JTextField();
    txtEnjoyedLic.setBounds(364, 8, 220, 20);
    panelSurv3.add(txtEnjoyedLic);
    txtEnjoyedLic.setColumns(10);

    JLabel lblNewLabel_8 =
        new JLabel("When you install reflexology, who are you entering an agreement with?");
    lblNewLabel_8.setBounds(10, 36, 412, 14);
    panelSurv3.add(lblNewLabel_8);

    String[] whoAgree = {
      "",
      "Don't know",
      "State of PA",
      "Penn State",
      "PA Court of Common Pleas",
      "PA District Court",
      "Reflexology Development Team"
    };
    cmbWhoAgree = new JComboBox(whoAgree);
    cmbWhoAgree.setBounds(432, 33, 152, 20);
    panelSurv3.add(cmbWhoAgree);

    JLabel lblTheLicenseAgreement =
        new JLabel("The license agreement applies to the following types of media:");
    lblTheLicenseAgreement.setBounds(10, 61, 368, 14);
    panelSurv3.add(lblTheLicenseAgreement);

    String[] mediaTypes = {
      "",
      "Don't know",
      "Software",
      "Digital Media Content",
      "Print Material",
      "Documentation",
      "All of the above"
    };
    cmbMediaTypes = new JComboBox(mediaTypes);
    cmbMediaTypes.setBounds(388, 61, 196, 20);
    panelSurv3.add(cmbMediaTypes);

    JLabel lblNewLabel_9 =
        new JLabel("Is it possible to purchase the Reflexology software? (explain below)");
    lblNewLabel_9.setBounds(10, 86, 566, 14);
    panelSurv3.add(lblNewLabel_9);

    txtPurchasing = new JTextField();
    txtPurchasing.setBounds(10, 111, 574, 20);
    panelSurv3.add(txtPurchasing);
    txtPurchasing.setColumns(10);

    JLabel lblTheLicenseAgreement_1 = new JLabel("The license agreement was visually appealing");
    lblTheLicenseAgreement_1.setBounds(20, 145, 386, 14);
    panelSurv3.add(lblTheLicenseAgreement_1);

    JLabel label_7 = new JLabel("Strongly disagree");
    label_7.setHorizontalAlignment(SwingConstants.RIGHT);
    label_7.setBounds(20, 170, 124, 25);
    panelSurv3.add(label_7);

    sldAesthetics = new JSlider();
    sldAesthetics.setValue(-1);
    sldAesthetics.setSnapToTicks(true);
    sldAesthetics.setPaintTicks(true);
    sldAesthetics.setPaintLabels(true);
    sldAesthetics.setMinorTickSpacing(1);
    sldAesthetics.setMinimum(1);
    sldAesthetics.setMaximum(5);
    sldAesthetics.setMajorTickSpacing(1);
    sldAesthetics.setBounds(154, 170, 274, 45);
    panelSurv3.add(sldAesthetics);

    JLabel label_8 = new JLabel("Strongly agree");
    label_8.setBounds(438, 170, 138, 25);
    panelSurv3.add(label_8);

    JLabel lblTheTextOf = new JLabel("This  license agreement was easy to understand");
    lblTheTextOf.setBounds(20, 226, 463, 14);
    panelSurv3.add(lblTheTextOf);

    JLabel label_10 = new JLabel("Strongly disagree");
    label_10.setHorizontalAlignment(SwingConstants.RIGHT);
    label_10.setBounds(20, 251, 124, 25);
    panelSurv3.add(label_10);

    sldUnderstandLic = new JSlider();
    sldUnderstandLic.setValue(-1);
    sldUnderstandLic.setSnapToTicks(true);
    sldUnderstandLic.setPaintTicks(true);
    sldUnderstandLic.setPaintLabels(true);
    sldUnderstandLic.setMinorTickSpacing(1);
    sldUnderstandLic.setMinimum(1);
    sldUnderstandLic.setMaximum(5);
    sldUnderstandLic.setMajorTickSpacing(1);
    sldUnderstandLic.setBounds(154, 251, 274, 45);
    panelSurv3.add(sldUnderstandLic);

    JLabel label_11 = new JLabel("Strongly agree");
    label_11.setBounds(438, 251, 138, 25);
    panelSurv3.add(label_11);

    JLabel label_6 = new JLabel("Strongly disagree");
    label_6.setHorizontalAlignment(SwingConstants.RIGHT);
    label_6.setBounds(20, 332, 124, 25);
    panelSurv3.add(label_6);

    sldAnnoyed = new JSlider();
    sldAnnoyed.setValue(-1);
    sldAnnoyed.setSnapToTicks(true);
    sldAnnoyed.setPaintTicks(true);
    sldAnnoyed.setPaintLabels(true);
    sldAnnoyed.setMinorTickSpacing(1);
    sldAnnoyed.setMinimum(1);
    sldAnnoyed.setMaximum(5);
    sldAnnoyed.setMajorTickSpacing(1);
    sldAnnoyed.setBounds(154, 332, 274, 45);
    panelSurv3.add(sldAnnoyed);

    JLabel label_9 = new JLabel("Strongly agree");
    label_9.setBounds(438, 332, 138, 25);
    panelSurv3.add(label_9);

    JLabel lblframe3LicenseAgreement =
        new JLabel("Something about this license agreement annoyed me");
    lblframe3LicenseAgreement.setBounds(10, 304, 463, 14);
    panelSurv3.add(lblframe3LicenseAgreement);

    JLabel label_12 = new JLabel("*WARNING* You cannot return to these answers.");
    label_12.setForeground(Color.RED);
    label_12.setBounds(89, 404, 277, 14);
    panelSurv3.add(label_12);

    btnPage4.setBounds(394, 400, 89, 23);
    panelSurv3.add(btnPage4);

    frame3.getContentPane().add(panelSurv4, "");
    panelSurv4.setLayout(null);

    JLabel lblNewLabel_10 =
        new JLabel("According to the license agreement, what does Penn State have ");
    lblNewLabel_10.setBounds(10, 11, 537, 14);
    panelSurv4.add(lblNewLabel_10);

    JLabel lblTheRightTo = new JLabel("the right to download from your computer?");
    lblTheRightTo.setBounds(10, 26, 504, 14);
    panelSurv4.add(lblTheRightTo);

    txtPSUDownload = new JTextField();
    txtPSUDownload.setBounds(10, 48, 553, 20);
    panelSurv4.add(txtPSUDownload);
    txtPSUDownload.setColumns(10);

    JLabel lblHowManyCopies =
        new JLabel("How many copies of Reflexology can you make for archival purposes?");
    lblHowManyCopies.setBounds(10, 79, 438, 14);
    panelSurv4.add(lblHowManyCopies);

    String[] archCopies = {"", "Don't know", "0", "1", "3", "5", "Unlimited"};
    cmbArchCopies = new JComboBox(archCopies);
    cmbArchCopies.setBounds(458, 79, 105, 20);
    panelSurv4.add(cmbArchCopies);

    JLabel lblYouCanLend = new JLabel("What can you do if you want to sue about Reflexology?");
    lblYouCanLend.setBounds(10, 116, 323, 14);
    panelSurv4.add(lblYouCanLend);

    JLabel lblUnderWhatCircumstances =
        new JLabel("Under what circumstances can Penn State terminate your use of the software? ");
    lblUnderWhatCircumstances.setBounds(10, 184, 537, 14);
    panelSurv4.add(lblUnderWhatCircumstances);

    txtTerminate = new JTextField();
    txtTerminate.setBounds(10, 209, 553, 20);
    panelSurv4.add(txtTerminate);
    txtTerminate.setColumns(10);

    sldTradKs = new JSlider();
    sldTradKs.setValue(-1);
    sldTradKs.setSnapToTicks(true);
    sldTradKs.setPaintTicks(true);
    sldTradKs.setPaintLabels(true);
    sldTradKs.setMinorTickSpacing(1);
    sldTradKs.setMinimum(1);
    sldTradKs.setMaximum(5);
    sldTradKs.setMajorTickSpacing(1);
    sldTradKs.setBounds(154, 268, 274, 45);
    panelSurv4.add(sldTradKs);

    JLabel label_13 = new JLabel("Strongly disagree");
    label_13.setHorizontalAlignment(SwingConstants.RIGHT);
    label_13.setBounds(20, 268, 124, 25);
    panelSurv4.add(label_13);

    JLabel label_14 = new JLabel("Strongly agree");
    label_14.setBounds(438, 268, 138, 25);
    panelSurv4.add(label_14);

    JLabel lblPeopleAreMore =
        new JLabel(
            "People are more likely to read traditional contracts than software license agreemenets");
    lblPeopleAreMore.setBounds(10, 240, 553, 14);
    panelSurv4.add(lblPeopleAreMore);

    JLabel lblwarningframe3Button =
        new JLabel("*WARNING* this button will instantly end the experiment ---->");
    lblwarningframe3Button.setForeground(Color.RED);
    lblwarningframe3Button.setBounds(38, 400, 350, 14);
    panelSurv4.add(lblwarningframe3Button);

    btnDone.setBounds(398, 391, 89, 23);
    panelSurv4.add(btnDone);

    txtArbite = new JTextField();
    txtArbite.setColumns(10);
    txtArbite.setBounds(10, 141, 553, 20);
    panelSurv4.add(txtArbite);

    ListenFor2Button lFor2Button = new ListenFor2Button();
    ListenFor3Button lFor3Button = new ListenFor3Button();
    ListenFor4Button lFor4Button = new ListenFor4Button();
    ListenFor5Button lFor5Button = new ListenFor5Button();
    btnPage2.addActionListener(lFor2Button);
    btnPage3.addActionListener(lFor3Button);
    btnPage4.addActionListener(lFor4Button);
    btnDone.addActionListener(lFor5Button);
  }
示例#17
0
  private void init(Boolean showSearch) {
    dependends = new ArrayList<HoopVisualFeatureVisualizer>();

    Border border = BorderFactory.createLineBorder(Color.black);
    Border bevel = BorderFactory.createLoweredBevelBorder();

    // setBackground(HoopJColorTools.parse("#ffffff"));

    this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    coreList = new JList();
    coreList.setCellRenderer(new HoopJCheckListItem());
    JScrollPane posScrollList = new JScrollPane(coreList);

    coreFilter = new JTextField();
    coreFilter.setMaximumSize(new Dimension(2000, 20));

    coreLabel = new JLabel("");
    coreLabel.setBorder(bevel);
    coreLabel.setHorizontalAlignment(JLabel.LEFT);
    coreLabel.setFont(new Font("Dialog", 1, 10));
    coreLabel.setBackground(HoopJColorTools.parse("#ffffff"));
    coreLabel.setMinimumSize(new Dimension(50, 20));
    coreLabel.setMaximumSize(new Dimension(2000, 20));

    colorPicker = new JPanel();
    colorPicker.setBackground(color);
    colorPicker.setBorder(border);
    colorPicker.setMinimumSize(new Dimension(20, 20));
    colorPicker.setPreferredSize(new Dimension(20, 20));
    colorPicker.setMaximumSize(new Dimension(20, 20));
    colorPicker.addMouseListener(this);

    Box labelBox = new Box(BoxLayout.X_AXIS);
    labelBox.add(coreLabel);
    labelBox.add(colorPicker);

    Box buttonBox = new Box(BoxLayout.X_AXIS);
    allButton = new JButton();
    allButton.setFont(new Font("Dialog", 1, 8));
    allButton.setPreferredSize(new Dimension(30, 20));
    allButton.setMaximumSize(new Dimension(2000, 20));
    allButton.setText("All");
    allButton.addActionListener(this);
    buttonBox.add(allButton);
    noneButton = new JButton();
    noneButton.setFont(new Font("Dialog", 1, 8));
    noneButton.setPreferredSize(new Dimension(30, 20));
    noneButton.setMaximumSize(new Dimension(2000, 20));
    noneButton.setText("None");
    noneButton.addActionListener(this);
    buttonBox.add(noneButton);
    inverseButton = new JButton();
    inverseButton.setFont(new Font("Dialog", 1, 8));
    inverseButton.setPreferredSize(new Dimension(30, 20));
    inverseButton.setMaximumSize(new Dimension(2000, 20));
    inverseButton.setText("Inverse");
    inverseButton.addActionListener(this);
    buttonBox.add(inverseButton);
    selectedButton = new JButton();
    selectedButton.setFont(new Font("Dialog", 1, 8));
    selectedButton.setPreferredSize(new Dimension(30, 20));
    selectedButton.setMaximumSize(new Dimension(2000, 20));
    selectedButton.setText("Selected");
    selectedButton.addActionListener(this);
    selectedButton.setEnabled(false);
    buttonBox.add(selectedButton);

    if (showSearch == true) {
      this.add(coreFilter);
    }

    this.add(labelBox);
    this.add(posScrollList);
    this.add(buttonBox);

    // >---------------------------------------------------

    coreFilter.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent keyEvent) {}

          public void keyReleased(KeyEvent keyEvent) {
            // debug ("Filtering on: " + coreFilter.getText());
            filterModel();
          }

          public void keyTyped(KeyEvent keyEvent) {}
        });

    // >---------------------------------------------------

    coreList.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent event) {
            JList list = (JList) event.getSource();

            // Get index of item clicked

            int index = list.locationToIndex(event.getPoint());
            HoopVisualFeature item = (HoopVisualFeature) coreList.getModel().getElementAt(index);

            // Toggle selected state

            item.setSelected(!item.isSelected());

            // Repaint cell

            list.repaint(list.getCellBounds(index, index));
            updateDependends();
          }
        });

    // >---------------------------------------------------
  }
  /*
   * GUI Code to add a modpack to the selection
   */
  public void addPack(final ModPack pack) {
    if (!modPacksAdded) {
      modPacksAdded = true;
      packs.removeAll();
      packs.repaint();
    }
    final int packIndex = packPanels.size();
    final JPanel p = new JPanel();
    p.setBounds(0, (packIndex * 55), 420, 55);
    p.setLayout(null);
    JLabel logo = new JLabel(new ImageIcon(pack.getLogo()));
    logo.setBounds(6, 6, 42, 42);
    logo.setVisible(true);

    JTextArea filler =
        new JTextArea(
            pack.getName()
                + " (v"
                + pack.getVersion()
                + ") Minecraft Version "
                + pack.getMcVersion()
                + "\n"
                + "By "
                + pack.getAuthor());
    filler.setBorder(null);
    filler.setEditable(false);
    filler.setForeground(LauncherStyle.getCurrentStyle().tabPaneForeground);
    filler.setBounds(58, 6, 362, 42);
    filler.setBackground(LauncherStyle.getCurrentStyle().tabPaneBackground);

    MouseAdapter lin =
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
              LaunchFrame.getInstance().doLaunch();
            }
          }

          @Override
          public void mousePressed(MouseEvent e) {
            selectedPack = packIndex;
            updatePacks();
          }
        };
    p.addMouseListener(lin);
    filler.addMouseListener(lin);
    logo.addMouseListener(lin);
    p.add(filler);
    p.add(logo);
    packPanels.add(p);
    packs.add(p);

    packs.setMinimumSize(new Dimension(420, (packPanels.size() * 55)));
    packs.setPreferredSize(new Dimension(420, (packPanels.size() * 55)));

    //
    // packsScroll.revalidate();
    if (pack.getDir().equalsIgnoreCase(getLastPack())) {
      selectedPack = packIndex;
    }
  }
示例#19
0
  static void buildGUI() {
    // Need this size to balance axes.
    frame.setSize(520, 690);
    frame.setTitle("DrawTool");
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });

    Container cPane = frame.getContentPane();

    // Status label on top. Unused for now.
    statusLabel.setOpaque(true);
    statusLabel.setBackground(Color.white);
    cPane.add(statusLabel, BorderLayout.NORTH);

    // Build the input/output elements at the bottom.
    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createLineBorder(Color.black));
    panel.setBackground(inputPanelColor);
    panel.setLayout(new GridLayout(2, 1));
    panel.add(outputLabel);
    JPanel bottomPanel = new JPanel();
    bottomPanel.setBackground(inputPanelColor);
    bottomPanel.add(inputField);
    bottomPanel.add(new JLabel("   "));
    JButton enterButton = new JButton("Enter");
    enterButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent a) {
            hasEntered = true;
          }
        });
    bottomPanel.add(enterButton);
    panel.add(bottomPanel);
    if (!sequencingOn) {
      cPane.add(panel, BorderLayout.SOUTH);
    }

    // Drawing in the center.
    drawArea = new DrawTool();
    if (sequencingOn) {
      frame.addKeyListener(
          new KeyAdapter() {
            public void keyTyped(KeyEvent e) {
              handleKeyTyped(e);
            }
          });
    }
    cPane.add(drawArea, BorderLayout.CENTER);

    drawArea.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            handleMouseClick(e);
          }

          public void mouseReleased(MouseEvent e) {
            handleMouseReleased(e);
          }
        });

    drawArea.addMouseMotionListener(
        new MouseMotionAdapter() {
          public void mouseDragged(MouseEvent e) {
            handleMouseDragged(e);
          }
        });
  }
示例#20
0
  /**
   * Shows/hides the security panel.
   *
   * @param isVisible <tt>true</tt> to show the security panel, <tt>false</tt> to hide it
   */
  public void setSecurityPanelVisible(final boolean isVisible) {
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              setSecurityPanelVisible(isVisible);
            }
          });
      return;
    }

    final JFrame callFrame = callRenderer.getCallContainer().getCallWindow().getFrame();

    final JPanel glassPane = (JPanel) callFrame.getGlassPane();

    if (!isVisible) {
      // Need to hide the security panel explicitly in order to keep the
      // fade effect.
      securityPanel.setVisible(false);
      glassPane.setVisible(false);
      glassPane.removeAll();
    } else {
      glassPane.setLayout(null);
      glassPane.addMouseListener(
          new MouseListener() {
            public void mouseClicked(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }

            public void mouseEntered(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }

            public void mouseExited(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }

            public void mousePressed(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }

            public void mouseReleased(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }
          });

      Point securityLabelPoint = securityStatusLabel.getLocation();

      Point newPoint =
          SwingUtilities.convertPoint(
              securityStatusLabel.getParent(),
              securityLabelPoint.x,
              securityLabelPoint.y,
              callFrame);

      securityPanel.setBeginPoint(new Point((int) newPoint.getX() + 15, 0));
      securityPanel.setBounds(0, (int) newPoint.getY() - 5, this.getWidth(), 130);

      glassPane.add(securityPanel);
      // Need to show the security panel explicitly in order to keep the
      // fade effect.
      securityPanel.setVisible(true);
      glassPane.setVisible(true);

      glassPane.addComponentListener(
          new ComponentAdapter() {
            /** Invoked when the component's size changes. */
            @Override
            public void componentResized(ComponentEvent e) {
              if (glassPane.isVisible()) {
                glassPane.setVisible(false);
                callFrame.removeComponentListener(this);
              }
            }
          });
    }
  }