public ConnectorSelectDialog(FlowEditorControl control) {
    super(control.getParent());
    setModal(true);

    gbm = new GridBagManager(this);

    setTitle("Verbindung wählen");

    gbm.setX(0).setY(0).setWeightX(0).setComp(new JLabel(Messagebox.QUESTION_ICON));

    gbm.setX(1).setY(0).setComp(new JLabel("Bitte wählen Sie den Verbindungstyp"));

    ImageIcon flowArrowIcon =
        FlowToolbar.addShadow(
            GuiImage.drawToImage(
                new FlowArrowImage(24, control.getSysintegration().getGuiConfig())));

    JButton btFlow = new JButton("Fluss");
    btFlow.setIcon(flowArrowIcon);
    btFlow.setIconTextGap(20);
    btFlow.setHorizontalAlignment(SwingConstants.LEFT);

    btFlow.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            ConnectorSelectDialog.this.arc = ArcType.FLOW;
            setVisible(false);
          }
        });

    gbm.setX(1).setY(2).setComp(btFlow);

    JButton btParam = new JButton("Parameter");
    btParam.setIcon(FlowToolbar.drawArrowIcon(control.getSysintegration().getGuiConfig()));
    gbm.setX(1).setY(3).setComp(btParam);
    btParam.setIconTextGap(20);
    btParam.setHorizontalAlignment(SwingConstants.LEFT);

    btParam.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            ConnectorSelectDialog.this.arc = ArcType.PARAMETER;
            setVisible(false);
          }
        });

    pack();
    setLocationRelativeTo(control.getParent());
  }
  private JButton createExampleButton(final CommonApp commonApp) {
    String iconResource = commonApp.getIconResource();
    Icon icon =
        iconResource == null
            ? new EmptyIcon()
            : new ImageIcon(getClass().getResource(iconResource));
    JButton button =
        new JButton(
            new AbstractAction(commonApp.getName(), icon) {
              public void actionPerformed(ActionEvent e) {
                commonApp.init(OptaPlannerExamplesApp.this, false);
              }
            });
    button.setHorizontalAlignment(JButton.LEFT);
    button.setHorizontalTextPosition(JButton.RIGHT);
    button.setVerticalTextPosition(JButton.CENTER);
    button.addMouseListener(
        new MouseAdapter() {

          public void mouseEntered(MouseEvent e) {
            descriptionTextArea.setText(commonApp.getDescription());
          }

          public void mouseExited(MouseEvent e) {
            descriptionTextArea.setText("");
          }
        });
    return button;
  }
Example #3
0
  private void createLayout() {
    mViewDocButton.setHorizontalAlignment(SwingConstants.LEFT);
    mViewDocButton.setEnabled(false);
    mLinksScrollPane.getViewport().add(mLinksList);
    setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.anchor = GridBagConstraints.CENTER;
    constraints.insets = GUIConstants.INSETS;
    constraints.gridwidth = 1;

    constraints.gridheight = 2;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.weightx = 1;
    constraints.weighty = 1;
    constraints.fill = GridBagConstraints.BOTH;
    add(mLinksScrollPane, constraints);

    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridheight = 1;
    constraints.gridx = 1;
    add(mViewDocButton, constraints);
  }
Example #4
0
  private void listPeople() {

    try {

      jScrollPane1.getViewport().setView(null);

      JFlowPanel jPeople = new JFlowPanel();
      jPeople.applyComponentOrientation(getComponentOrientation());

      java.util.List people = m_dlSystem.listPeopleVisible();

      for (int i = 0; i < people.size(); i++) {

        AppUser user = (AppUser) people.get(i);

        JButton btn = new JButton(new AppUserAction(user));
        btn.applyComponentOrientation(getComponentOrientation());
        btn.setFocusPainted(false);
        btn.setFocusable(false);
        btn.setRequestFocusEnabled(false);
        btn.setHorizontalAlignment(SwingConstants.LEADING);
        btn.setMaximumSize(new Dimension(150, 50));
        btn.setPreferredSize(new Dimension(150, 50));
        btn.setMinimumSize(new Dimension(150, 50));

        jPeople.add(btn);
      }
      jScrollPane1.getViewport().setView(jPeople);

    } catch (BasicException ee) {
      ee.printStackTrace();
    }
  }
 private void initButton(JButton button) {
   button.setText("");
   button.setBorder(RAISED_BORDER);
   button.setBorderPainted(false);
   button.setFocusPainted(false);
   button.setHorizontalAlignment(SwingConstants.CENTER);
   button.setVerticalAlignment(SwingConstants.CENTER);
 }
  public void initComponents() {
    /** ******************** The main container *************************** */
    Container container = this.getContentPane();
    container.setLayout(new BorderLayout());
    container.setBackground(Color.black);
    this.setSize(650, 600);
    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {}
        });

    /** ************************* MAIN PANEL ******************************* */
    mainPanel = new JPanel();
    // If put to False: we see the container's background
    mainPanel.setOpaque(false);
    mainPanel.setLayout(new BorderLayout());
    container.add(mainPanel, BorderLayout.CENTER);

    allmessagesTextArea = new TextArea();
    allmessagesTextArea.setEditable(false);
    allmessagesTextArea.setFont(new Font("Dialog", 1, 12));
    allmessagesTextArea.setForeground(Color.black);
    allmessagesTextArea.append("Select a session in the list to view its messages");
    mainPanel.add(allmessagesTextArea, BorderLayout.CENTER);

    sessionsList = new List();
    sessionsList.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            showMessages(e);
          }
        });
    sessionsList.setForeground(Color.black);
    sessionsList.setFont(new Font("Dialog", 1, 14));
    mainPanel.add(sessionsList, BorderLayout.WEST);

    okButton = new JButton("  OK  ");
    okButton.setToolTipText("Returns to the main frame");
    okButton.setFont(new Font("Dialog", 1, 16));
    okButton.setFocusPainted(false);
    okButton.setBackground(Color.lightGray);
    okButton.setBorder(new BevelBorder(BevelBorder.RAISED));
    okButton.setVerticalAlignment(SwingConstants.CENTER);
    okButton.setHorizontalAlignment(SwingConstants.CENTER);
    container.add(okButton, BorderLayout.SOUTH);
    okButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            setVisible(false);
          }
        });
  }
Example #7
0
  /**
   * List of Local Variables: azure: Color object to set as background buttonFont: Font object to
   * use in buttons newGame: JButton object switchPlayer: JButton object quit: JButton object
   *
   * <p>Explanation: default constructor
   */
  public Board() {
    Color azure = new Color(240, 255, 255); // create colour

    // enable custom resizing (java sets components in ratios by default)
    this.setLayout(null);

    // add mouse listener
    this.addMouseListener(this);
    // change background colour
    this.setBackground(azure);

    // create font to use for buttons
    Font buttonFont = new Font("Times New Roman", Font.BOLD, 18);

    // create+add new Game button
    // String with some basic HTML for multi-line/centering
    JButton newGame = new JButton("<html><center>New<br>Game</center></html>");
    newGame.setFont(buttonFont);
    newGame.setHorizontalAlignment(SwingConstants.CENTER);
    newGame.setActionCommand("New Game");
    newGame.setBounds(570, 135, 80, 75);
    newGame.addActionListener(this);
    this.add(newGame);

    // create+add switch Player Button
    JButton switchPlayer = new JButton("<html><center>Switch<br>Player</center></html>");
    switchPlayer.setFont(buttonFont);
    switchPlayer.setHorizontalAlignment(SwingConstants.CENTER);
    switchPlayer.setActionCommand("Switch Player");
    switchPlayer.setBounds(570, 220, 80, 75);
    switchPlayer.addActionListener(this);
    this.add(switchPlayer);

    // create+add quit Button
    JButton quit = new JButton("<html><center>Quit</center></html>");
    quit.setFont(buttonFont);
    quit.setHorizontalAlignment(SwingConstants.CENTER);
    quit.setActionCommand("Quit");
    quit.setBounds(570, 305, 80, 75);
    quit.addActionListener(this);
    this.add(quit);
  }
Example #8
0
  @Override
  public void actionPerformed(ActionEvent e) {
    setResizable(false);
    setBounds(100, 100, 450, 300);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    add(contentPane);
    contentPane.setLayout(null);

    JLabel credits = new JLabel();
    credits.setBounds(25, 25, 400, 170);
    credits.setText(
        "<html>VCellID for ImageJ<br/>Version 1.0<br/>by Alejandro Petit and Gisela de la Villa</html>");
    credits.setVerticalAlignment(SwingConstants.CENTER);
    credits.setHorizontalAlignment(SwingConstants.CENTER);
    contentPane.add(credits);

    JLabel lblForMoreHelp = new JLabel("For more help on CellID options visit:");
    lblForMoreHelp.setBounds(10, 193, 422, 14);
    contentPane.add(lblForMoreHelp);

    JButton button = new JButton("Link");
    button.setBounds(50, 218, 350, 23);
    final URI uri;
    try {
      uri = new URI("http://ip138.qb.fcen.uba.ar/embnet/Cell-ID-Rcell/Cell-ID-main.htm");
      button.setText("Cell-ID Online Help");
      button.setHorizontalAlignment(SwingConstants.CENTER);
      button.setBorderPainted(false);
      button.setOpaque(false);
      button.setBackground(Color.lightGray);
      button.setForeground(Color.BLUE);
      button.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              if (Desktop.isDesktopSupported()) {
                Desktop desktop = Desktop.getDesktop();
                try {
                  desktop.browse(uri);
                } catch (Exception ex) {
                }
              } else {
              }
            }
          });
      contentPane.add(button);
    } catch (URISyntaxException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }

    setVisible(true);
  }
 /**
  * Gets the instance of the SlowButton
  *
  * @return The instance of the SlowButton
  */
 public static JButton getSlowButton() {
   if (slowButton == null) {
     slowButton = new JButton();
     slowButton.setText(Constants.STOP);
     slowButton.setHorizontalAlignment(SwingConstants.CENTER);
     slowButton.setFont(Constants.DEFAULT_BUTTON_FONT);
     slowButton.setAlignmentX(Component.CENTER_ALIGNMENT);
     slowButton.setActionCommand(Constants.SLOW);
     slowButton.addActionListener(ButtonListener.getInstance());
   }
   return slowButton;
 }
 /**
  * Gets the instance of the CenterButton
  *
  * @return The instance of the CenterButton
  */
 public static JButton getCenterButton() {
   if (centerButton == null) {
     centerButton = new JButton();
     centerButton.setText(Constants.CENTER);
     centerButton.setHorizontalAlignment(SwingConstants.CENTER);
     centerButton.setFont(new Font("Dialog", Font.BOLD, 14));
     centerButton.setAlignmentX(Component.CENTER_ALIGNMENT);
     centerButton.setActionCommand(Constants.CENTER);
     centerButton.addActionListener(ButtonListener.getInstance());
   }
   return centerButton;
 }
 /**
  * Gets the instance of the ConnectButton
  *
  * @return The instance of the ConnectButton
  */
 public static JButton getConnectButton() {
   if (connectButton == null) {
     connectButton = new JButton();
     connectButton.setText(Constants.CONNECT);
     connectButton.setHorizontalAlignment(SwingConstants.CENTER);
     connectButton.setFont(Constants.DEFAULT_BUTTON_FONT);
     connectButton.setAlignmentX(Component.CENTER_ALIGNMENT);
     connectButton.setActionCommand(Constants.CONNECT);
     connectButton.addActionListener(ButtonListener.getInstance());
   }
   return connectButton;
 }
  private void initComponents() {
    buttonsPanel = new JPanel();
    buttonsPanel.setLayout(new GridLayout(0, 1, 3, 3));

    Action action;

    action =
        new ManageBookmarksAction(
            VFSResources.getMessage("VFSJFileChooser.bookmarksLabelText"), getIcon("book.png"));
    bookmarksButton = new JButton(action);
    bookmarksButton.setHorizontalAlignment(SwingConstants.LEFT);

    action =
        new ConnectionWizardAction(
            VFSResources.getMessage("VFSJFileChooser.connectionButtonText"),
            getIcon("connect.png"));
    connectionsButton = new JButton(action);
    connectionsButton.setHorizontalAlignment(SwingConstants.LEFT);

    action =
        new LocalFilesAction(
            VFSResources.getMessage("VFSJFileChooser.localFilesButtonText"), getIcon("drive.png"));
    localFSButton = new JButton(action);
    localFSButton.setHorizontalAlignment(SwingConstants.LEFT);

    buttonsPanel.add(bookmarksButton);
    buttonsPanel.add(Box.createVerticalStrut(20));
    buttonsPanel.add(connectionsButton);
    buttonsPanel.add(Box.createVerticalStrut(20));
    buttonsPanel.add(localFSButton);

    add(buttonsPanel, BorderLayout.NORTH);
    add(new JPanel(), BorderLayout.CENTER);

    final Frame c = (Frame) SwingUtilities.getWindowAncestor(fileChooser);

    bookmarksDialog = new BookmarksDialog(c, fileChooser);

    connectionDialog = new ConnectionDialog(c, bookmarksDialog, fileChooser);
  }
 /**
  * Gets the instance of the ResetButton
  *
  * @return The instance of the ResetButton
  */
 public static JButton getResetButton() {
   if (resetButton == null) {
     resetButton = new JButton();
     resetButton.setText(Constants.RESET);
     resetButton.setHorizontalAlignment(SwingConstants.CENTER);
     resetButton.setFont(Constants.DEFAULT_BUTTON_FONT);
     resetButton.setAlignmentX(Component.CENTER_ALIGNMENT);
     resetButton.setActionCommand(Constants.RESET);
     resetButton.addActionListener(ButtonListener.getInstance());
     resetButton.setEnabled(false);
   }
   return resetButton;
 }
 public ScriptComboBoxEditor() {
   showEditorBtn = new JButton();
   script = "";
   setButtonText();
   showEditorBtn.setHorizontalAlignment(SwingConstants.LEFT);
   showEditorBtn.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           editScript(false);
         }
       });
   actionListeners = new LinkedList<ActionListener>();
   minimumSize = new Dimension(100, 60);
 }
Example #15
0
  /**
   * This method initializes the components for second panel. This is the panel with hyperlink to
   * the company website
   */
  private void initComponentsInLinkPanel() {
    linkLabel = new JLabel("Link do artukułu:");
    linkLabel.setFont(new Font("Serif", Font.PLAIN, FONTSIZE));
    linkPanel.add(linkLabel);

    linkButton =
        new JButton("<HTML><U>http://www.bluemedia.pl/o-nas/partnerzy-i-klienci</U></HTML>");
    linkButton.setFont(new Font("Serif", Font.PLAIN, FONTSIZE));
    linkButton.setForeground(Color.BLUE);
    linkButton.setHorizontalAlignment(SwingConstants.LEFT);
    linkButton.setBorderPainted(false);
    linkButton.setOpaque(false);
    linkButton.setBackground(Color.WHITE);
    linkButton.addActionListener(this);
    linkPanel.add(linkButton);
  }
Example #16
0
  /**
   * This method initializes the components for third panel. This is the panel with hyperlink to the
   * file path
   */
  private void initComponentsInPathPanel() {
    pathLabel = new JLabel("Adres do pliku .txt z listą partnerów:");
    pathLabel.setFont(new Font("Serif", Font.PLAIN, FONTSIZE));
    pathPanel.add(pathLabel);

    workingDir = System.getProperty("user.dir");

    pathButton = new JButton(workingDir);
    pathButton.setFont(new Font("Serif", Font.PLAIN, FONTSIZE));
    pathButton.setForeground(Color.BLUE);
    pathButton.setHorizontalAlignment(SwingConstants.LEFT);
    pathButton.setBorderPainted(false);
    pathButton.setOpaque(false);
    pathButton.setBackground(Color.WHITE);
    pathButton.addActionListener(this);
    pathPanel.add(pathButton);
  }
  public ButtonTable(Dimension buttonSize, final JButton... buttons) {
    // setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    JTable table = new JTable();
    table.setTableHeader(null);
    // table.setFillsViewportHeight(true);
    setViewportView(table);

    table.setModel(
        new AbstractTableModel() {

          @Override
          public Object getValueAt(int rowIndex, int columnIndex) {
            return null;
          }

          @Override
          public int getRowCount() {
            return buttons.length;
          }

          @Override
          public int getColumnCount() {
            return 1;
          }

          @Override
          public boolean isCellEditable(int rowIndex, int columnIndex) {
            return true;
          }
        });

    // set all to left align... looks better
    for (JButton button : buttons) {
      button.setHorizontalAlignment(SwingConstants.LEFT);
    }

    CustomTableItemRenderer<JButton> renderer = new CustomTableItemRenderer(buttons);
    TableColumn buttonCol = table.getColumnModel().getColumn(0);
    buttonCol.setCellEditor(renderer);
    buttonCol.setCellRenderer(renderer);
    buttonCol.setWidth(buttonSize.width);
    table.setRowHeight(buttonSize.height);
    setPreferredSize(
        new Dimension(buttonSize.width + 6, table.getRowHeight() * table.getRowCount() + 10));
  }
Example #18
0
  private JButton addStyleButton(
      DefaultFormBuilder rightBuilder, String label, AFreeplaneAction action) {
    final JButton button =
        new JButton() {
          private static final long serialVersionUID = 1L;

          {
            setUI(BasicButtonUI.createUI(this));
          }
        };
    button.addActionListener(action);
    button.setHorizontalAlignment(SwingConstants.LEFT);
    final String labelText = TextUtils.getText(label);
    UITools.addTitledBorder(button, labelText, 10);
    rightBuilder.append(button, rightBuilder.getColumnCount());
    rightBuilder.nextLine();
    return button;
  }
Example #19
0
    private void initButton() {
      int actionCommandId = 1;
      for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 7; j++) {
          JButton numberButton = new JButton();
          numberButton.setBorder(BorderFactory.createEmptyBorder());
          numberButton.setHorizontalAlignment(SwingConstants.CENTER);
          numberButton.setActionCommand(String.valueOf(actionCommandId));

          numberButton.addMouseListener(this);

          numberButton.setBackground(palletTableColor);
          numberButton.setForeground(dateFontColor);
          numberButton.setText(String.valueOf(actionCommandId));
          numberButton.setPreferredSize(new Dimension(25, 25));
          daysButton[i][j] = numberButton;
          actionCommandId++;
        }
      }
    }
  /*
   * This class handles login process
   */
  @SuppressWarnings("serial")
  public AdminLogin() {
    LoginLabel = new JLabel("Logedin As: ");
    LoginName = new JLabel("");

    LoginLabel.setForeground(Color.red);
    UName = new JLabel("Staff ID:	");
    Pword = new JLabel("Password:	");

    resetPassword = new JButton();

    resetPassword.setText(
        "<HTML>Forgot Password? <FONT color=\"#000099\"><U>Reset Password</U></FONT></HTML>");
    resetPassword.setHorizontalAlignment(SwingConstants.LEFT);
    resetPassword.setBorderPainted(false);
    resetPassword.setFont(new Font("Dialog", Font.PLAIN, 10));

    UserName = new JTextField("", 20);
    Password = new JPasswordField("", 20);
    LogIn = new JButton("Login");
    Logout = new JButton("Logout");
    Logout.setEnabled(false);
    gbc = new GridBagConstraints();

    db = new DatabaseHelper();

    // Make the panel wider than it really needs, so
    // the window's wide enough for the tabs to stay
    // in one row.
    card =
        new JPanel() {
          public Dimension getPreferredSize() {
            Dimension size = super.getPreferredSize();
            size.width += extraWindowWidth;
            return size;
          }
        };

    resetPasswordCliclListner();
  }
  @Override
  protected void addButtons(final JPanel buttonBar) {

    more = new JButton(_AWU.T.ExceptionDialog_layoutDialogContent_more_button());

    more.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    // more.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0,
    // cp.getBackground().darker()));
    more.addActionListener(
        new ActionListener() {

          public void actionPerformed(final ActionEvent e) {

            expand();
          }
        });
    more.setHorizontalAlignment(SwingConstants.RIGHT);
    buttonBar.add(more, "hidemode 3");
    if (expanded) {
      expand();
    }
  }
  /**
   * Set up the expander button to display qualifier values.
   *
   * @param butt - expander button
   * @param qualifier - the qualifer that is being displayed
   * @param qualifierValueBox - Box containing the values
   * @param qualifierNameCheckBox - JCheckBox for the given qualifier
   * @param pane
   * @return
   */
  private Vector<JCheckBox> setExpanderButton(
      final JButton butt,
      final Qualifier qualifier,
      final Box qualifierValueBox,
      final JCheckBox qualifierNameCheckBox) {
    butt.setMargin(new Insets(0, 0, 0, 0));
    butt.setHorizontalAlignment(SwingConstants.RIGHT);
    butt.setHorizontalTextPosition(SwingConstants.RIGHT);
    butt.setBorderPainted(false);
    butt.setFont(butt.getFont().deriveFont(Font.BOLD));
    butt.setForeground(TransferAnnotationTool.STEEL_BLUE);

    butt.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (butt.getText().equals("+")) butt.setText("-");
            else butt.setText("+");

            qualifierValueBox.setVisible(butt.getText().equals("-"));
            revalidate();
          }
        });

    // set-up qualifier values list
    qualifierValueBox.setVisible(false);
    final Vector<JCheckBox> qualifierValuesCheckBox = new Vector<JCheckBox>();
    final StringVector values = qualifier.getValues();
    if (values != null) {
      for (int i = 0; i < values.size(); i++) {
        final JCheckBox cb = new JCheckBox(values.get(i), qualifierNameCheckBox.isSelected());
        cb.setFont(cb.getFont().deriveFont(Font.ITALIC));
        qualifierValueBox.add(cb);
        qualifierValuesCheckBox.add(cb);
      }
    }
    return qualifierValuesCheckBox;
  }
Example #23
0
  /** Setup button positioning on panel */
  private void setUpButtons() {
    /* Initialize buttons */
    apply = new JButton("Apply changes");
    apply.setIcon(applyIcon);
    apply.setHorizontalAlignment(SwingConstants.RIGHT);
    preview = new JButton("Preview");
    openSubtitle = new JButton("Load subtitle file (.srt)");
    createSub = new JButton("Create subtitle file (.srt)");
    editSubtitle = new JButton("Edit Subtitles");
    editSubtitle.setEnabled(false);

    /* Add buttons to locations in the panel */
    GridBagConstraints gbc = tools.addConstraints(openSubtitle, 0, 12, 4, 1, true);
    add(openSubtitle, gbc);
    gbc = tools.addConstraints(createSub, 4, 12, 4, 1, true);
    add(createSub, gbc);
    gbc = tools.addConstraints(editSubtitle, 0, 13, 8, 1, true);
    add(editSubtitle, gbc);
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(preview);
    buttonPanel.add(apply);
    gbc = tools.addConstraints(buttonPanel, 0, 11, 8, 1, true);
    add(buttonPanel, gbc);
  }
  private JPanel getWeekAndDayPanal() {
    String colname[] = {"日", "一", "二", "三", "四", "五", "六"};
    JPanel result = new JPanel();
    // 设置固定字体,以免调用环境改变影响界面美观
    result.setFont(new Font("宋体", Font.PLAIN, 12));
    result.setLayout(new GridLayout(7, 7));
    result.setBackground(Color.white);
    JLabel cell;

    for (int i = 0; i < 7; i++) {
      cell = new JLabel(colname[i]);
      cell.setHorizontalAlignment(JLabel.RIGHT);
      if (i == 0 || i == 6) cell.setForeground(weekendFontColor);
      else cell.setForeground(weekFontColor);
      result.add(cell);
    }

    int actionCommandId = 0;
    for (int i = 0; i < 6; i++)
      for (int j = 0; j < 7; j++) {
        JButton numberButton = new JButton();
        numberButton.setBorder(null);
        numberButton.setHorizontalAlignment(SwingConstants.RIGHT);
        numberButton.setActionCommand(String.valueOf(actionCommandId));
        numberButton.addActionListener(this);
        numberButton.setBackground(palletTableColor);
        numberButton.setForeground(dateFontColor);
        if (j == 0 || j == 6) numberButton.setForeground(weekendFontColor);
        else numberButton.setForeground(dateFontColor);
        daysButton[i][j] = numberButton;
        result.add(numberButton);
        actionCommandId++;
      }

    return result;
  }
Example #25
0
  // *********************************************CONSTRUCTOR METHOD
  public EPoverty() throws IOException {
    UIManager.put("Button.select", Color.BLACK);

    // ******************************************CREATE MAIN PANEL
    setTitle("|||E-Poverty || V-0.1 (SKELETON)|||");
    setSize(500, 275);
    setLocation(500, 200);
    setVisible(true);
    setResizable(false);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    mainPanel = new JPanel();
    setContentPane(mainPanel);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));
    // ******************************************END OF CREATING MAIN PANEL

    /* CREATE THE TOP AND BOTTOM PANELS, ADDING BACKGROUND IMAGES
     *
     * BackgroundPanel is an extension to JPanel that makes it easy to
     * paint images as a background on the panel, or add a gradient
     * fill as the background (this is what you currently see on the
     * back of all the tabs.  The constructors can be seen in the
     * BackgroundPanel.java class if you need or want to use them.
     */
    BackgroundPanel topPanel = new BackgroundPanel(background);
    Dimension top = new Dimension(500, 125);
    topPanel.setPreferredSize(top);
    GradientPaint paintTop = new GradientPaint(0, 0, Color.DARK_GRAY, 100, 100, Color.BLACK);
    topPanel.setPaint(paintTop);

    BackgroundPanel bottomPanel = new BackgroundPanel(null, BackgroundPanel.ACTUAL, 1.0f, 0.5f);
    Dimension bottom = new Dimension(500, 75);
    bottomPanel.setPreferredSize(bottom);
    GradientPaint paintBottom = new GradientPaint(50, 200, Color.WHITE, 100, 50, Color.BLACK);
    bottomPanel.setPaint(paintBottom);

    // *******************************************ADD PANELS TO THE MAIN
    mainPanel.add(topPanel);
    mainPanel.add(bottomPanel);

    // ******************************************ADD COMPONENTS TO THE BOTTOM PANEL
    bottomPanel.setLayout(new GridBagLayout());
    GridBagConstraints gBC = new GridBagConstraints();
    gBC.fill = GridBagConstraints.HORIZONTAL;

    // *****************************************FIRST ROW (BLANK)
    JLabel blank = new JLabel("");
    gBC.weightx = 1;
    gBC.weighty = 1;
    gBC.gridx = 0;
    gBC.gridy = 0;
    bottomPanel.add(blank, gBC);

    blank = new JLabel("");
    gBC.gridx = 1;
    gBC.gridy = 0;
    bottomPanel.add(blank, gBC);

    blank = new JLabel("");
    gBC.gridx = 2;
    gBC.gridy = 0;
    bottomPanel.add(blank, gBC);

    blank = new JLabel("");
    gBC.gridx = 3;
    gBC.gridy = 0;
    bottomPanel.add(blank, gBC);

    blank = new JLabel("");
    gBC.gridx = 4;
    gBC.gridy = 0;
    bottomPanel.add(blank, gBC);

    blank = new JLabel("");
    gBC.gridx = 5;
    gBC.gridy = 0;
    bottomPanel.add(blank, gBC);

    // *****************************************SECOND ROW (LOGIN)
    blank = new JLabel("LOGIN");
    gBC.gridx = 1;
    gBC.gridy = 1;
    gBC.gridheight = 2;
    gBC.gridwidth = 2;
    blank.setForeground(Color.WHITE);
    blank.setFont(new Font("Serif", Font.PLAIN, 16));
    bottomPanel.add(blank, gBC);
    blank.setHorizontalTextPosition(SwingConstants.RIGHT);

    login_TF = new JTextField("[email protected]");
    gBC.gridx = 3;
    gBC.gridy = 1;
    login_TF.setEditable(true);
    login_TF.setBackground(Color.WHITE);
    login_TF.setFont(new Font("Serif", Font.PLAIN, 16));
    login_TF.setForeground(Color.LIGHT_GRAY);
    bottomPanel.add(login_TF, gBC);
    login_TF.requestFocusInWindow();

    // ******************************************THIRD ROW (PASSWORD)
    blank = new JLabel("PASSWORD");
    gBC.gridx = 1;
    gBC.gridy = 3;
    blank.setForeground(Color.WHITE);
    blank.setFont(new Font("Serif", Font.PLAIN, 16));
    blank.setHorizontalTextPosition(JLabel.RIGHT);
    bottomPanel.add(blank, gBC);

    password_TF = new JPasswordField("password");
    gBC.gridx = 3;
    gBC.gridy = 3;
    password_TF.setEditable(true);
    password_TF.setForeground(Color.WHITE);
    password_TF.setFont(new Font("Serif", Font.PLAIN, 16));
    bottomPanel.add(password_TF, gBC);

    // *****************************************FOURTH ROW (BLANK)
    blank = new JLabel("");
    gBC.gridx = 1;
    gBC.gridy = 3;
    gBC.gridheight = 1;
    bottomPanel.add(blank, gBC);

    // *****************************************FIFTH ROW (BUTTONS)
    JButton login_BTN = new JButton("");
    gBC.gridx = 3;
    gBC.gridy = 5;
    gBC.gridwidth = 1;
    login_BTN.setIcon(new ImageIcon(login));
    login_BTN.setMargin(new Insets(0, 0, 0, 0));
    login_BTN.setBackground(Color.LIGHT_GRAY);
    login_BTN.setRolloverEnabled(false);
    login_BTN.setFocusPainted(false);
    login_BTN.setContentAreaFilled(false);
    bottomPanel.add(login_BTN, gBC);

    JButton settings_BTN = new JButton("Settings");
    gBC.gridx = 5;
    gBC.gridy = 5;
    gBC.gridheight = 3;
    settings_BTN.setIcon(new ImageIcon(settings));
    settings_BTN.setMargin(new Insets(0, 0, 0, 0));
    settings_BTN.setHorizontalAlignment(SwingConstants.RIGHT);
    settings_BTN.setVerticalTextPosition(SwingConstants.CENTER);
    settings_BTN.setHorizontalTextPosition(SwingConstants.LEFT);
    settings_BTN.setBackground(Color.LIGHT_GRAY);
    settings_BTN.setBorderPainted(false);
    settings_BTN.setRolloverEnabled(false);
    settings_BTN.setFocusPainted(false);
    settings_BTN.setContentAreaFilled(false);
    bottomPanel.add(settings_BTN, gBC);

    // *****************************************SIXTH ROW (BLANK)
    blank = new JLabel("");
    gBC.gridx = 1;
    gBC.gridy = 5;
    bottomPanel.add(blank, gBC);

    // This makes sure all components are painted on the screen correctly
    mainPanel.validate();

    // ADD AN ACTION LISTENER TO THE BUTTON THAT WILL CHECK THE LOGIN INFO AND LOG INTO THE DATABASE
    login_BTN.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            String passwordHash = "";
            // Hash the password for comparison
            try {
              passwordHash = SimpleSHA1.SHA1(password_TF.getText());
            } catch (NoSuchAlgorithmException ex) {
              Logger.getLogger(EPoverty.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
              Logger.getLogger(EPoverty.class.getName()).log(Level.SEVERE, null, ex);
            }

            String checkAdminSQL =
                "SELECT p.password FROM persons AS p, admins AS a "
                    + "WHERE p.personId = a.personId "
                    + "AND p.emailAddress = \""
                    + login_TF.getText()
                    + "\" ";

            try {
              // *********************************CHECK LOGIN AND PASSWORD
              new DBconnection(url, driver, dbLogin, dbPassword);
              conn = DBconnection.getConnection();
              PreparedStatement stmt = (PreparedStatement) conn.prepareStatement(checkAdminSQL);
              ResultSet rs = (ResultSet) stmt.executeQuery();

              // IF THERE IS NO NEXT RECORD, E-MAIL IS NOT THAT OF AN ADMIN
              if (!rs.next()) {
                new Warnings("You do not have login rights.");
              } else {
                String dbPass = rs.getObject(1).toString();

                // CHECK VALUE OF RETURNED PASSWORD TO VALUE ENTERED
                if (dbPass.equals(passwordHash)) {
                  try {
                    new EPovertyMain();
                    EPovertyMain.updateStatus("Logged in");
                    dispose();

                  } catch (IOException ex) {
                    Logger.getLogger(EPoverty.class.getName()).log(Level.SEVERE, null, ex);
                  }
                } else {
                  new Warnings("Incorrect Password.");
                }
              }

              rs.close();
              stmt.close();
              DBconnection.closeConnection();

            } catch (ClassNotFoundException ex) {
              Logger.getLogger(EPoverty.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
              Logger.getLogger(EPoverty.class.getName()).log(Level.SEVERE, null, ex);
            }
          }
        }); // END OF LOGIN BUTTON LISTENER

    settings_BTN.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              new Settings();
            } catch (ClassNotFoundException ex) {
              Logger.getLogger(EPoverty.class.getName()).log(Level.SEVERE, null, ex);
            }
          }
        }); // END OF SETTINGS BUTTON LISTENER
  }
 private void setLookLowered(JButton button) {
   button.setBorder(LOWERED_BORDER);
   button.setHorizontalAlignment(SwingConstants.RIGHT);
   button.setVerticalAlignment(SwingConstants.BOTTOM);
   button.setBorderPainted(true);
 }
 private void setLookRaised(JButton button) {
   button.setBorder(RAISED_BORDER);
   button.setHorizontalAlignment(SwingConstants.CENTER);
   button.setVerticalAlignment(SwingConstants.CENTER);
   button.setBorderPainted(true);
 }
Example #28
0
  /**
   * Create the frame.
   *
   * @param course
   * @param id
   * @param firstname
   * @param name
   */
  public StudentG() {
    setResizable(false);
    setTitle("Student - Hauptansicht");
    setLocationRelativeTo(null);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent event) {
            Master.openNewLogin();
            setVisible(false);
          }
        });

    setBounds(100, 100, 909, 481);
    contentPane = new JPanel();
    contentPane.setBorder(new LineBorder(new Color(0, 0, 0)));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    PersonalDataP persoPanel = new PersonalDataP();
    persoPanel.setBorder(
        new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    persoPanel.setBounds(21, 29, 307, 403);
    contentPane.add(persoPanel);

    JPanel Calls = new JPanel();
    Calls.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    Calls.setBounds(338, 29, 544, 99);
    contentPane.add(Calls);
    Calls.setLayout(null);

    JButton btnNotenAnzeigenaktualisieren = new JButton("Noten anzeigen/aktualisieren");
    btnNotenAnzeigenaktualisieren.setHorizontalAlignment(SwingConstants.LEFT);
    btnNotenAnzeigenaktualisieren.addActionListener(
        new ActionListener() {
          /** Ruft die Noten des Studenten ab und ruft die fillTable Methode. */
          public void actionPerformed(ActionEvent e) {
            myMarks = Master.getMyTwoDimensionalArrayList("getMyMarks", null, null);
            fillTable(false);
          }
        });
    btnNotenAnzeigenaktualisieren.setBounds(10, 22, 201, 23);
    Calls.add(btnNotenAnzeigenaktualisieren);

    JButton btnNotenschnittAnzeigen = new JButton("Notenschnitt anzeigen");
    btnNotenschnittAnzeigen.setHorizontalAlignment(SwingConstants.LEFT);
    btnNotenschnittAnzeigen.addActionListener(
        new ActionListener() {
          /**
           * Holt den Schnitt des jeweiligen Studenten und zeigt ihn im Label "lblAverage" an.
           * Einfacher Aufruf mit dem Master.
           */
          public void actionPerformed(ActionEvent arg0) {

            double average = Master.getMyDouble("getMyTotalAverage", null, null);
            lblAverage.setText(String.valueOf(average));
          }
        });
    btnNotenschnittAnzeigen.setBounds(10, 56, 201, 23);
    Calls.add(btnNotenschnittAnzeigen);

    lblAverage = new JLabel("");
    lblAverage.setBounds(231, 63, 56, 16);
    Calls.add(lblAverage);

    JButton btnNewButton = new JButton("Noten schlechter 4,0 makieren");
    btnNewButton.setHorizontalAlignment(SwingConstants.LEFT);
    btnNewButton.addActionListener(
        new ActionListener() {
          /**
           * Prüft ob die Noten bereits geholt wurden oder nicht. <br>
           * Wenn myMarks gefüllt ist, gibt er die ArrayList an die fillTable Methode weiter.
           */
          public void actionPerformed(ActionEvent e) {

            // Wenn die Noten bereits abgeholt wurden nicht nochmal neu
            // holen.
            //

            if (myMarks != null) {
              fillTable(true);
            } else {
              myMarks = Master.getMyTwoDimensionalArrayList("getMyMarks", null, null);
              fillTable(true);
            }
          }
        });
    btnNewButton.setBounds(221, 22, 228, 23);
    Calls.add(btnNewButton);

    tablePanel = new JPanel();
    tablePanel.setBorder(
        new TitledBorder(
            new TitledBorder(
                UIManager.getBorder("TitledBorder.border"),
                "Noten\u00FCbersicht",
                TitledBorder.LEADING,
                TitledBorder.TOP,
                null,
                null),
            "Noten\u00FCbersicht",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    tablePanel.setBounds(338, 144, 545, 292);
    contentPane.add(tablePanel);
    tablePanel.setLayout(null);
    createandAddTable(rowData, columnNames);
  }
Example #29
0
  /** Erzeugt die Komponenten */
  private final void initComponents() {
    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.BOTH;
    constraints.weightx = 1;
    constraints.weighty = 0;
    constraints.insets = new Insets(1, 1, 1, 1);

    setLayout(layout);

    setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

    constraints.gridx = 0;
    constraints.gridy = 0;
    m_jlPosition.setPreferredSize(new Dimension(100, 10));
    layout.setConstraints(m_jlPosition, constraints);
    add(m_jlPosition);

    final JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createLineBorder(Color.GRAY));
    panel.setBackground(ColorLabelEntry.BG_STANDARD);
    panel.setOpaque(true);

    m_jbSpieler.setToolTipText(
        ho.core.model.HOVerwaltung.instance().getLanguageString("tt_Spiel_Spielerdetails"));
    m_jbSpieler.setHorizontalAlignment(SwingConstants.LEFT);
    m_jbSpieler.setMargin(new Insets(0, 1, 0, 1));
    m_jbSpieler.setPreferredSize(new Dimension(125, 15));
    m_jbSpieler.setFocusPainted(false);
    m_jbSpieler.setEnabled(false);
    m_jbSpieler.addActionListener(this);
    m_jbSpieler.setBackground(ColorLabelEntry.BG_STANDARD);
    m_jbSpieler.setOpaque(true);
    m_jbSpieler.setBorder(BorderFactory.createEmptyBorder());
    panel.add(m_jbSpieler, BorderLayout.CENTER);

    panel.add(m_jlSpecial, BorderLayout.EAST);

    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.weighty = 0.5; // Give extra vertical space to the player
    // button
    constraints.gridwidth = 1;
    layout.setConstraints(panel, constraints);
    add(panel);

    switch (m_iPositionsID) {
      case ISpielerPosition.keeper:
      case ISpielerPosition.rightBack:
      case ISpielerPosition.leftBack:
      case ISpielerPosition.rightCentralDefender:
      case ISpielerPosition.middleCentralDefender:
      case ISpielerPosition.leftCentralDefender:
      case ISpielerPosition.rightInnerMidfield:
      case ISpielerPosition.centralInnerMidfield:
      case ISpielerPosition.leftInnerMidfield:
      case ISpielerPosition.leftWinger:
      case ISpielerPosition.rightWinger:
      case ISpielerPosition.rightForward:
      case ISpielerPosition.centralForward:
      case ISpielerPosition.leftForward:
      case ISpielerPosition.ausgewechselt:
        {
          constraints.gridx = 0;
          constraints.gridy = 2;
          constraints.weighty = 0; // No vertical stretch for this one

          final JComponent component = m_jpSterne.getComponent(false);
          layout.setConstraints(component, constraints);
          add(component);

          setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
          break;
        }

      default:
        setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT_REDUCED));
    }
  }
Example #30
0
  Primary() {
    // Initial declarations, adding of listeners, and database linking.
    // Database link
    DBHookUp db = new DBHookUp();

    // Frame stuff
    frame = new JFrame("4 Byte Warrior");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBackground(Color.RED);
    frame.setResizable(false);
    // Panels
    main = new JPanel();
    scores = new JPanel();
    credits = new JPanel();
    story = new JPanel();
    tutorial = new JPanel();
    main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
    main.setBackground(Color.RED);
    main.setOpaque(true);
    scores.setLayout(new BorderLayout());
    scores.setBackground(Color.RED);
    scores.setOpaque(true);
    credits.setLayout(new BorderLayout());
    credits.setBackground(Color.RED);
    credits.setOpaque(true);
    // story.setLayout(new BoxLayout(story, BoxLayout.PAGE_AXIS));
    story.setLayout(new BorderLayout());
    story.setBackground(Color.RED);
    story.setOpaque(true);
    // tutorial.setLayout(new BoxLayout(tutorial, BoxLayout.PAGE_AXIS));
    tutorial.setLayout(new BorderLayout());
    tutorial.setBackground(Color.RED);
    tutorial.setOpaque(true);

    // Buttons
    start = new JButton("Go");
    start.addActionListener(this);
    start.setPreferredSize(new Dimension(125, 35));
    start.setAlignmentX(start.CENTER_ALIGNMENT);
    start.setBackground(Color.BLACK);
    start.setForeground(Color.WHITE);
    start.setHorizontalAlignment(SwingConstants.CENTER);
    cred = new JButton("Credits");
    cred.setPreferredSize(new Dimension(125, 35));
    cred.addActionListener(this);
    cred.setAlignmentX(cred.CENTER_ALIGNMENT);
    cred.setBackground(Color.BLACK);
    cred.setForeground(Color.WHITE);
    cred.setHorizontalAlignment(SwingConstants.CENTER);
    high = new JButton("High Scores");
    high.addActionListener(this);
    high.setPreferredSize(new Dimension(125, 35));
    high.setAlignmentX(high.CENTER_ALIGNMENT);
    high.setBackground(Color.BLACK);
    high.setForeground(Color.WHITE);
    high.setHorizontalAlignment(SwingConstants.CENTER);
    stor = new JButton("Next");
    stor.addActionListener(this);
    stor.setPreferredSize(new Dimension(100, 35));
    stor.setAlignmentX(stor.CENTER_ALIGNMENT);
    stor.setBackground(Color.BLACK);
    stor.setForeground(Color.WHITE);
    stor.setHorizontalAlignment(SwingConstants.CENTER);
    tutor = new JButton("Play");
    tutor.addActionListener(this);
    tutor.setPreferredSize(new Dimension(100, 35));
    tutor.setAlignmentX(tutor.CENTER_ALIGNMENT);
    tutor.setBackground(Color.BLACK);
    tutor.setForeground(Color.WHITE);
    returns1 = new JButton("Return");
    returns1.addActionListener(this);
    returns1.setPreferredSize(new Dimension(100, 35));
    returns1.setAlignmentX(returns1.CENTER_ALIGNMENT);
    returns1.setBackground(Color.BLACK);
    returns1.setForeground(Color.WHITE);
    returns1.setHorizontalAlignment(SwingConstants.CENTER);
    returns2 = new JButton("Return");
    returns2.addActionListener(this);
    returns2.setPreferredSize(new Dimension(100, 35));
    returns2.setAlignmentX(returns2.CENTER_ALIGNMENT);
    returns2.setBackground(Color.BLACK);
    returns2.setForeground(Color.WHITE);
    returns2.setHorizontalAlignment(SwingConstants.CENTER);
    returns3 = new JButton("Return");
    returns3.addActionListener(this);
    returns3.setPreferredSize(new Dimension(100, 35));
    returns3.setAlignmentX(returns3.CENTER_ALIGNMENT);
    returns3.setBackground(Color.BLACK);
    returns3.setForeground(Color.WHITE);
    returns3.setHorizontalAlignment(SwingConstants.CENTER);
    returns4 = new JButton("Return");
    returns4.addActionListener(this);
    returns4.setPreferredSize(new Dimension(100, 35));
    returns4.setAlignmentX(returns4.CENTER_ALIGNMENT);
    returns4.setBackground(Color.BLACK);
    returns4.setForeground(Color.WHITE);
    returns4.setHorizontalAlignment(SwingConstants.CENTER);

    // Text display
    theme = new JLabel();
    String text =
        String.format(
            "<html><div style=\"width:%dpx;\"><center><font size = \"4\">%s</font></center></div><html>",
            300,
            "Binary was a land of peace, ruled by the good king Groshi. "
                + "One day, the Dark Knight and his armies descended upon "
                + "the kingdom, throwing it into chaos. The Dark Knight "
                + "killed Groshi and kidnapped his daughter Elsie. "
                + "Only one memember of the kingdom could hope to "
                + "save the kingdom...<br/><br/>"
                + "<font size = \"7\"> THE 4 BYTE WARRIOR </font>");
    theme.setText(text);
    theme.setHorizontalAlignment(JLabel.CENTER);
    theme.setVerticalAlignment(JLabel.CENTER);
    theme.setForeground(Color.WHITE);
    instruct = new JLabel();
    String instruction =
        String.format(
            "<html><div style=\"width:%dpx;\"><center>%s</center></div><html>",
            200,
            "Z Key: Attack<br/>X Key: Cycle through inventory<br/>D-Pad: Movement<br/>A: Pause<br/><br/><br/>Defeat the enemeies to advance. Fight the bosses, get through the 8 worlds of Binary, and save Princess Elsie.");
    instruct.setText(instruction);
    instruct.setHorizontalAlignment(JLabel.CENTER);
    instruct.setVerticalAlignment(JLabel.CENTER);
    instruct.setForeground(Color.WHITE);
    String names =
        String.format(
            "<html><div style=\"width:%dpx;\"><center>%s</center></div><html>",
            150, "Alexander Friebe<br/>Charles Heckel<br/>Nicholas Lindsley<br/>Ben McWerthy<br/>");
    people = new JLabel(names);
    people.setHorizontalAlignment(JLabel.CENTER);
    people.setVerticalAlignment(JLabel.CENTER);
    people.setForeground(Color.WHITE);
    String major =
        String.format(
            "<html><div style=\"width:%dpx;\"><center>%s</center></div><html>",
            150,
            "Computer Science<br/>Computer Engineering<br/>Computer Engineering<br/>Computer Science<br/>");
    majors = new JLabel(major);
    majors.setHorizontalAlignment(JLabel.CENTER);
    majors.setVerticalAlignment(JLabel.CENTER);
    majors.setForeground(Color.WHITE);
    String credi =
        String.format(
            "<html><div style=\"width:%dpx;\"><center><font size = \"4\">%s</font></center></div><html>",
            150, "Credits");
    top = new JLabel(credi);
    top.setHorizontalAlignment(JLabel.CENTER);
    top.setVerticalAlignment(JLabel.CENTER);
    top.setForeground(Color.WHITE);
    scoresTop = new JLabel();
    String scTop =
        String.format(
            "<html><div style=\"width:%dpx;\"><center><font size = \"4\">%s</font></center></div><html>",
            200, "High Scores for Enemies Killed");
    scoresTop.setText(scTop);
    scoresTop.setForeground(Color.WHITE);
    scoresTop.setHorizontalAlignment(JLabel.CENTER);
    scoresTop.setVerticalAlignment(JLabel.CENTER);
    JLabel dbScores = new JLabel();
    ArrayList<Integer> sc = db.getScores();
    System.out.println(sc.size());
    // System.out.println(sc.get(0));
    String actual =
        String.format(
            "<html><div style=\"width:%dpx;\"><center><font size = \"4\">%s</font></center></div><html>",
            100, sc.get(0) + "<br/>" + sc.get(1) + "<br/>" + sc.get(2) + "<br/>");
    dbScores.setText(actual);
    dbScores.setHorizontalAlignment(JLabel.CENTER);
    dbScores.setVerticalAlignment(JLabel.CENTER);
    dbScores.setForeground(Color.WHITE);

    // Additions to main
    mainButtons = new JPanel(new GridLayout(3, 1));
    mainButtons.add(start);
    mainButtons.add(high);
    mainButtons.add(cred);
    main.add(mainButtons);

    // Additions to credits
    credits.add(top, BorderLayout.PAGE_START);
    // credits.add(people, BorderLayout.LINE_START);
    // credits.add(majors, BorderLayout.LINE_END);
    JPanel middle = new JPanel(new GridLayout(1, 2));
    middle.add(people);
    middle.add(majors);
    middle.setBackground(Color.RED);
    JPanel bottom = new JPanel(new GridLayout(1, 1));
    bottom.add(returns2);
    bottom.setBackground(Color.RED);
    credits.add(middle, BorderLayout.CENTER);
    credits.add(bottom, BorderLayout.PAGE_END);

    // Additions to high scores
    scores.add(scoresTop, BorderLayout.PAGE_START);
    scores.add(dbScores, BorderLayout.CENTER);
    JPanel bot = new JPanel(new GridLayout(1, 1));
    bot.add(returns1);
    bot.setBackground(Color.RED);
    scores.add(bot, BorderLayout.PAGE_END);

    // Additions to story
    story.add(theme, BorderLayout.CENTER);
    buttons = new JPanel(new GridLayout(2, 1));
    buttons.setBackground(Color.RED);
    // buttons.setOpaque(true);
    buttons.add(stor);
    buttons.add(returns3);
    story.add(buttons, BorderLayout.PAGE_END);

    // Additions to tutorial
    JPanel tutButtons = new JPanel(new GridLayout(2, 1));
    tutorial.add(instruct, BorderLayout.CENTER);
    tutButtons.add(tutor);
    tutButtons.add(returns4);
    tutButtons.setBackground(Color.RED);
    tutorial.add(tutButtons, BorderLayout.PAGE_END);

    main.setBorder(new EmptyBorder(100, 150, 100, 150));
    bot.setBorder(new EmptyBorder(0, 150, 0, 150));
    // middle.setBorder(new EmptyBorder(0,150,0,150));
    bottom.setBorder(new EmptyBorder(0, 150, 0, 150));
    buttons.setBorder(new EmptyBorder(0, 150, 0, 150));
    tutButtons.setBorder(new EmptyBorder(0, 150, 0, 150));
    frame.add(main);

    frame
        .pack(); // critical to call before you make the window visible in order to make everything
                 // look right 100% of the time
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }