@Override
    public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
      if (list instanceof CheckList) {
        // calculate the max width of the logo
        int maxWidth = 0;
        for (int i = 0; i < list.getModel().getSize(); i++) {
          Object obj = list.getModel().getElementAt(i);
          if (obj instanceof MediaScraper) {
            MediaScraper ms = (MediaScraper) obj;
            ImageIcon logo = getIcon(ms.getLogoURL());
            maxWidth = Math.max(maxWidth, logo.getIconWidth());
          }
        }

        CheckList cbl = (CheckList) list;
        ListCheckModel model = cbl.getModel();
        boolean checked = model.isChecked(value);
        boolean locked = model.isLocked(value);
        setSelected(checked);

        if (locked || cbl.isEnabled() == false) {
          setEnabled(false);
        } else {
          setEnabled(true);
        }

        if (getHighlight().equals(Highlight.MOUSE_OVER_AND_CHECKED_ITEMS)
            && (checked || isSelected)) {
          panel.setBackground(selectionBackground);
          panel.setForeground(selectionForeground);
        } else if (getHighlight().equals(Highlight.MOUSE_OVER) && isSelected) {
          panel.setBackground(selectionBackground);
          panel.setForeground(selectionForeground);
        } else if (getHighlight().equals(Highlight.CHECKED_ITEMS) && checked) {
          panel.setBackground(selectionBackground);
          panel.setForeground(selectionForeground);
        } else {
          panel.setBackground(background);
          panel.setForeground(foreground);
        }
        if (value instanceof MediaScraper) {
          MediaScraper scraper = (MediaScraper) value;
          int currentWidth = 0;
          ImageIcon logo = getIcon(scraper.getLogoURL());
          if (logo != null) {
            currentWidth = logo.getIconWidth();
          }

          label.setIcon(logo);
          label.setIconTextGap(maxWidth + 4 - currentWidth); // 4 = default iconTextGap
        } else {
          label.setIcon(null);
          label.setIconTextGap(4); // 4 = default iconTextGap
        }
      }
      label.setText(getText(value));
      return panel;
    }
Beispiel #2
0
 public void setForeground(Color color) {
   super.setForeground(color);
   if (logo != null) logo.setForeground(color);
   if (center != null) center.setForeground(color);
   // if(bottom != null)
   // bottom.setForeground(color);
   if (marketSharePanel != null) marketSharePanel.setForeground(color);
 }
Beispiel #3
0
 public void setForeground(Color fg) {
   super.setForeground(fg);
   if (label != null) {
     label.setForeground(fg);
     draw.setForeground(fg);
   }
 }
 @Override
 public void setForeground(Color fg) {
   super.setForeground(fg);
   if (rendererComponent != null) {
     rendererComponent.setForeground(fg);
   }
 }
 private void initGUI() {
   try {
     {
       this.setPreferredSize(new java.awt.Dimension(541, 172));
     }
     {
       jPanel1 = new JPanel();
       FlowLayout jPanel1Layout1 = new FlowLayout();
       getContentPane().add(getJPanel2(), BorderLayout.CENTER);
       getContentPane().add(getJPanel3(), BorderLayout.SOUTH);
       getContentPane().add(jPanel1, BorderLayout.NORTH);
       jPanel1.setLayout(jPanel1Layout1);
       jPanel1.setPreferredSize(new java.awt.Dimension(392, 45));
       jPanel1.setEnabled(false);
       jPanel1.setForeground(new java.awt.Color(0, 0, 255));
       jPanel1.add(getJLabel1());
       if (buttonGroup1 == null) {
         buttonGroup1 = new ButtonGroup();
       }
     }
     this.setSize(541, 172);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  /**
   * Sets the foreground color.
   *
   * @param fg the new foreground
   */
  public void setForeground(Color fg) {
    super.setForeground(fg);

    if (dayChooser != null) {
      dayChooser.setForeground(fg);
      monthChooser.setForeground(fg);
      yearChooser.setForeground(fg);
    }
  }
Beispiel #7
0
  public static void showPopup(Component parent, String title, String message, int x, int y) {
    JLabel descr = new JLabel(message);
    JLabel tit = new JLabel(title);

    JPanel pn = new JPanel(new BorderLayout());
    JPanel tpn = new JPanel(new GridBagLayout());
    tpn.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.GRAY));
    CloseButton cb = new CloseButton();
    tpn.add(
        cb,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(2, 0, 5, 0),
            0,
            0));
    tpn.add(
        tit,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 0, 2, 5),
            0,
            0));
    tpn.setOpaque(false);
    pn.add(tpn, BorderLayout.NORTH);
    pn.add(descr, BorderLayout.CENTER);
    //    pn.setFont(new Font("Dialog", Font.PLAIN, 11));
    pn.setBackground(SystemColor.info);
    pn.setForeground(SystemColor.infoText);
    pn.setOpaque(true);
    pn.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK),
            BorderFactory.createEmptyBorder(0, 5, 5, 5)));

    final Popup p = PopupFactory.getSharedInstance().getPopup(parent, pn, x, y);
    cb.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            p.hide();
          }
        });
    p.show();
  }
 @Override
 public void setForeground(Color fg) {
   super.setForeground(fg);
   if (left == null) return;
   left.setForeground(fg);
   for (int i = 0; i < rights.length; i++) {
     rights[i].setForeground(fg);
   }
 }
Beispiel #9
0
  public ViewerPanel(String userName, String serverName) {
    this.serverName = serverName;
    this.userName = userName;

    // TODO: use the tasim_viewer.conf file
    // NOTE: this should actually be the tac09aa_viewer.conf file
    String configFile = "tasim_viewer.conf";
    // String configFile = "tac13adx_viewer.conf";
    URL configURL = ViewerPanel.class.getResource("/config/" + configFile);
    config = new ConfigManager();
    try {
      if (configURL != null) {
        config.loadConfiguration(configURL);
      } else if (!config.loadConfiguration("config" + File.separatorChar + configFile)) {
        // Failed to load the configuration.
        log.severe("could not find config " + configFile);
      }
    } catch (Exception e) {
      log.severe("could not find config " + configFile);
    }

    // Should not be hardcoded but setup depending on simulation type. FIX
    // THIS!!! 0 \TODO

    viewer = null;

    try {
      String simulationViewerClass = config.getProperty("simulationViewer");
      viewer = (SimulationViewer) Class.forName(simulationViewerClass).newInstance();
    } catch (InstantiationException e) {
      log.severe("Could not instantiate the simulation viewer");
    } catch (IllegalAccessException e) {
      log.severe("Could not instantiate the simulation viewer");
    } catch (ClassNotFoundException e) {
      log.severe("Could not find the simulation viewer class");
    }

    viewer.init(this);
    viewerPanel = viewer.getComponent();

    mainPanel = new JPanel(new BorderLayout());
    mainPanel.setForeground(foregroundColor);
    mainPanel.setBackground(backgroundColor);
    mainPanel.add(viewerPanel, BorderLayout.CENTER);
    statusLabel = new JLabel("Status:");
    statusLabel.setOpaque(true);
    statusLabel.setForeground(foregroundColor);
    statusLabel.setBackground(backgroundColor);
    chatPanel = new ChatPanel(this);
    // Hack to avoid using another panel
    chatPanel.setStatusLabel(statusLabel);
    mainPanel.add(chatPanel, BorderLayout.SOUTH);
    statusPanel = new StatusPanel(this, foregroundColor, backgroundColor);
    mainPanel.add(statusPanel, BorderLayout.NORTH);
  }
  private void setPanelBackGroundForeGround(
      JPanel panel, Color selectionBackground, Color selectionForeground, boolean labelBold) {
    panel.setBackground(selectionBackground);
    panel.setForeground(selectionForeground);

    for (int i = 0; i < panel.getComponents().length; i++) {
      panel.getComponent(i).setBackground(selectionBackground);
      panel.getComponent(i).setForeground(selectionForeground);
      if (panel.getComponent(i) instanceof JLabel && labelBold) {
        ((JLabel) panel.getComponent(i))
            .setText("<html><b>" + ((JLabel) panel.getComponent(i)).getText() + "</html></b>");
      }
    }
  }
 private JPanel getStringLevels(EnumLevelList ll) {
   JPanel levelPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
   levelPanel.setBackground(Color.white);
   levelPanel.setForeground(Color.black);
   Iterator i = ll.getLevelIterator();
   JLabel levelLabel = null;
   EnumLevel level = null;
   while (i != null && i.hasNext()) {
     level = (EnumLevel) i.next();
     levelLabel = new JLabel(level.toString() + "  | ");
     levelLabel.setForeground(ARMY_GREEN);
     levelPanel.add(levelLabel);
     // levelPanel.add(new JSeparator(SwingConstants.HORIZONTAL));
   }
   return levelPanel;
 }
  @Override
  public Component getTreeCellRendererComponent(
      JTree tree,
      Object value,
      boolean sel,
      boolean expanded,
      boolean leaf,
      int row,
      boolean hasFocus1) {

    Component comp =
        super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus1);

    // Set icon

    RocketComponent c = (RocketComponent) value;

    if (c.getClass().isAssignableFrom(MassComponent.class)) {
      MassComponentType t = ((MassComponent) c).getMassComponentType();
      setIcon(ComponentIcons.getSmallMassTypeIcon(t));
    } else {
      setIcon(ComponentIcons.getSmallIcon(value.getClass()));
    }
    if (c.isMassOverridden() || c.isCGOverridden()) {
      JPanel p = new JPanel();
      p.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 1));
      p.setBackground(UIManager.getColor("Tree.textBackground"));
      p.setForeground(UIManager.getColor("Tree.textForeground"));
      p.add(comp /* , BorderLayout.WEST */);
      if (c.isMassOverridden()) {
        p.add(new JLabel(Icons.MASS_OVERRIDE));
      }
      if (c.isCGOverridden()) {
        p.add(new JLabel(Icons.CG_OVERRIDE));
      }
      p.setToolTipText(getToolTip(c));
      comp = p;
    }

    // Set tooltip
    this.setToolTipText(getToolTip(c));

    return comp;
  }
Beispiel #13
0
  public ResolutionDialog(Waves wave, Engine e) {
    setLayout(new BorderLayout());
    setResizable(false);
    setBounds(200, 200, 200, 140);
    setTitle("Preferences");
    engine = e;

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            setVisible(false);
          }
        });

    panel = new JPanel();
    panel.setBackground(Color.darkGray.darker());
    panel.setForeground(Color.white);
    add(panel);

    label = new JLabel("Resolution:", Label.RIGHT);
    label.setBounds(10, 10, 60, 20);
    panel.add(label);

    resolution = new IntBox(0, 800, 200, 3);
    panel.add(resolution);

    /*gouraud = new JCheckBox("Gouraud Shading", true);
    gouraud.setBounds(10, 40, 120, 20);
    panel.add(gouraud);*/
    panel.add(new JLabel("Maximum Resolution: 800"));

    ok = new JButton("    Ok    ");
    panel.add(ok);
    ok.addActionListener(this);

    cancel = new JButton("Cancel");
    panel.add(cancel);
    cancel.addActionListener(this);

    // implement WSL Items
    okScripter = new ButtonScripter(ok, wave.getWSLPlayer(), null, "ok");
    cancelScripter = new ButtonScripter(cancel, wave.getWSLPlayer(), null, "cancel");
  }
 private JPanel getJPanelTortuga() {
   if (jPanelTortuga == null) {
     jPanelTortuga = new JPanel();
     jPanelTortuga.setForeground(Color.WHITE);
     jPanelTortuga.setBorder(new LineBorder(Color.BLUE, 5));
     jPanelTortuga.setBackground(Color.BLUE);
     jPanelTortuga.setBounds(88, 248, 778, 77);
     jPanelTortuga.setLayout(new GridLayout(1, 11, 2, 10));
     jPanelTortuga.add(getButton_1());
     jPanelTortuga.add(getButton_2());
     jPanelTortuga.add(getButton_3());
     jPanelTortuga.add(getButton_4());
     jPanelTortuga.add(getButton_5());
     jPanelTortuga.add(getButton_6());
     jPanelTortuga.add(getButton_7());
     jPanelTortuga.add(getButton_8());
     jPanelTortuga.add(getButton_9());
     jPanelTortuga.add(getButton_13());
     jPanelTortuga.add(getButton_11());
     modificarPanel(getJPanelTortuga(), false);
   }
   return jPanelTortuga;
 }
 private JPanel getJPanel_Liebre() {
   if (jPanel_Liebre == null) {
     jPanel_Liebre = new JPanel();
     jPanel_Liebre.setBackground(Color.BLUE);
     jPanel_Liebre.setForeground(Color.WHITE);
     jPanel_Liebre.setBorder(new LineBorder(Color.BLUE, 5));
     jPanel_Liebre.setBounds(88, 137, 778, 77);
     jPanel_Liebre.setLayout(new GridLayout(1, 11, 2, 10));
     jPanel_Liebre.add(getBtL0());
     jPanel_Liebre.add(getBtL1());
     jPanel_Liebre.add(getBtL2());
     jPanel_Liebre.add(getBtL3());
     jPanel_Liebre.add(getBtL4());
     jPanel_Liebre.add(getBtL5());
     jPanel_Liebre.add(getBtL6());
     jPanel_Liebre.add(getBtL7());
     jPanel_Liebre.add(getBtL8());
     jPanel_Liebre.add(getBtL9());
     jPanel_Liebre.add(getBtL10());
     modificarPanel(getJPanel_Liebre(), false);
   }
   return jPanel_Liebre;
 }
 /** {@inheritDoc} */
 @Override
 public Component getListCellRendererComponent(
     JList<? extends TradeRouteStop> list,
     TradeRouteStop value,
     int index,
     boolean isSelected,
     boolean hasFocus) {
   JPanel panel = (isSelected) ? SELECTED_COMPONENT : NORMAL_COMPONENT;
   panel.removeAll();
   panel.setForeground(list.getForeground());
   panel.setFont(list.getFont());
   Location location = value.getLocation();
   ImageLibrary lib = getImageLibrary();
   JLabel icon, name;
   if (location instanceof Europe) {
     Europe europe = (Europe) location;
     Image image = lib.getSmallerMiscIconImage(europe.getOwner().getNation());
     icon = new JLabel(new ImageIcon(image));
     name = Utility.localizedLabel(europe);
   } else if (location instanceof Colony) {
     Colony colony = (Colony) location;
     icon =
         new JLabel(
             new ImageIcon(
                 ImageLibrary.getSettlementImage(colony, lib.getScaleFactor() * 0.5f)));
     name = new JLabel(colony.getName());
   } else {
     throw new IllegalStateException("Bogus location: " + location);
   }
   panel.add(icon, "spany");
   panel.add(name, "span, wrap");
   for (GoodsType cargo : value.getCargo()) {
     panel.add(new JLabel(new ImageIcon(lib.getSmallerIconImage(cargo))));
   }
   return panel;
 }
  /**
   * Initializes the GUI by creating the components, placing them in the dialog, and displaying
   * them.
   */
  private void init() {
    setForeground(Color.black);

    setTitle("Nonlocal Means Filter");

    JPanel mainPanel;
    mainPanel = new JPanel();
    mainPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    mainPanel.setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.weightx = 1;
    gbc.insets = new Insets(3, 3, 3, 3);
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;

    paramPanel = new JPanel(new GridBagLayout());
    paramPanel.setForeground(Color.black);
    paramPanel.setBorder(buildTitledBorder("Parameters"));
    mainPanel.add(paramPanel, gbc);

    GridBagConstraints gbc2 = new GridBagConstraints();
    gbc2.gridwidth = 1;
    gbc2.gridheight = 1;
    gbc2.anchor = GridBagConstraints.WEST;
    gbc2.weightx = 1;
    gbc2.insets = new Insets(3, 3, 3, 3);
    gbc2.gridx = 0;
    gbc2.gridy = 0;
    gbc2.fill = GridBagConstraints.HORIZONTAL;

    labelSearchWindowSide = createLabel("Search window side (odd)");

    paramPanel.add(labelSearchWindowSide, gbc2);

    gbc2.gridx = 1;
    textSearchWindowSide = createTextField("15");
    paramPanel.add(textSearchWindowSide, gbc2);

    gbc2.gridx = 0;
    gbc2.gridy = 1;
    labelSimilarityWindowSide = createLabel("Similarity window side (odd) ");
    paramPanel.add(labelSimilarityWindowSide, gbc2);

    gbc2.gridx = 1;
    textSimilarityWindowSide = createTextField("7");
    paramPanel.add(textSimilarityWindowSide, gbc2);

    gbc2.gridx = 0;
    gbc2.gridy = 2;
    labelNoiseStandardDeviation = createLabel("Noise standard deviation ");
    paramPanel.add(labelNoiseStandardDeviation, gbc2);

    gbc2.gridx = 1;
    textNoiseStandardDeviation = createTextField("10.0");
    paramPanel.add(textNoiseStandardDeviation, gbc2);

    gbc2.gridx = 0;
    gbc2.gridy = 3;
    labelDegree = createLabel("Degree of filtering ");
    labelDegree.setEnabled(doRician);
    paramPanel.add(labelDegree, gbc2);

    gbc2.gridx = 1;
    textDegree = createTextField("1.414");
    textDegree.setEnabled(doRician);
    paramPanel.add(textDegree, gbc2);

    gbc2.gridx = 0;
    gbc2.gridy = 4;
    doRicianCheckBox = new JCheckBox("Deal with Rician noise in MRI");
    doRicianCheckBox.setFont(serif12);
    doRicianCheckBox.setSelected(false);
    doRicianCheckBox.addActionListener(this);
    paramPanel.add(doRicianCheckBox, gbc2);

    if (image.getNDims() > 2) {
      gbc2.gridx = 0;
      gbc2.gridy = 5;
      gbc2.gridwidth = 2;

      image25DCheckBox = new JCheckBox("Process each slice independently (2.5D)");
      image25DCheckBox.setFont(serif12);
      paramPanel.add(image25DCheckBox, gbc2);
      image25DCheckBox.setSelected(false);
    } // if (image.getNDims > 2)

    JPanel outputOptPanel = new JPanel(new GridLayout(1, 2));
    destinationPanel = new JPanel(new BorderLayout());
    destinationPanel.setForeground(Color.black);
    destinationPanel.setBorder(buildTitledBorder("Destination"));
    outputOptPanel.add(destinationPanel);

    destinationGroup = new ButtonGroup();
    newImage = new JRadioButton("New image", true);
    newImage.setBounds(10, 16, 120, 25);
    newImage.setFont(serif12);
    destinationGroup.add(newImage);
    destinationPanel.add(newImage, BorderLayout.NORTH);

    replaceImage = new JRadioButton("Replace image", false);
    replaceImage.setFont(serif12);
    destinationGroup.add(replaceImage);
    destinationPanel.add(replaceImage, BorderLayout.CENTER);

    // Only if the image is unlocked can it be replaced.
    if (image.getLockStatus() == ModelStorageBase.UNLOCKED) {
      replaceImage.setEnabled(true);
    } else {
      replaceImage.setEnabled(false);
    }

    gbc.gridx = 0;
    gbc.gridy = 1;
    mainPanel.add(outputOptPanel, gbc);

    mainDialogPanel.add(mainPanel, BorderLayout.CENTER);
    mainDialogPanel.add(buildButtons(), BorderLayout.SOUTH);

    getContentPane().add(mainDialogPanel);

    pack();
    setResizable(true);
    // setVisible(true);

    System.gc();
  }
  void setupGUI() {
    taDictionary = new TextArea();
    taDictionary.setLocation(0, 0);
    taDictionary.setSize(106, 567);
    taDictionary.setBackground(new Color(-1));
    taDictionary.setText("");
    taDictionary.setRows(5);
    taDictionary.setColumns(1);
    getContentPane().add(taDictionary);

    tfSourc = new TextField();
    tfSourc.setLocation(224, 90);
    tfSourc.setSize(266, 25);
    tfSourc.setBackground(new Color(-1));
    tfSourc.setText("");
    tfSourc.setColumns(10);
    getContentPane().add(tfSourc);

    lblSourc = new Label();
    lblSourc.setLocation(106, 90);
    lblSourc.setSize(119, 25);
    lblSourc.setText("Source Word:");
    getContentPane().add(lblSourc);
    /*
    lblDestinatio = new Label();
    lblDestinatio.setLocation(106,97);
    lblDestinatio.setSize(119,25);
    lblDestinatio.setText("Destination Wor");
    getContentPane().add(lblDestinatio);
       */

    lblDestinatio = new Label();
    lblDestinatio.setLocation(106, 120);
    lblDestinatio.setSize(119, 25);
    lblDestinatio.setText("Destination Word:");
    getContentPane().add(lblDestinatio);

    lblWordSize = new Label();
    lblWordSize.setLocation(106, 27); // 106,120
    lblWordSize.setSize(119, 25);
    lblWordSize.setText("Word Size:");
    getContentPane().add(lblWordSize);

    tfWordSize = new TextField();
    tfWordSize.setLocation(224, 27); // 224,120
    tfWordSize.setSize(263, 25);
    tfWordSize.setBackground(new Color(-1));
    tfWordSize.setText("5");
    tfWordSize.setColumns(10);
    getContentPane().add(tfWordSize);

    tfSourc_6 = new TextField();
    tfSourc_6.setLocation(226, 120);
    tfSourc_6.setSize(263, 25);
    tfSourc_6.setBackground(new Color(-1));
    tfSourc_6.setText("");
    tfSourc_6.setColumns(10);
    getContentPane().add(tfSourc_6);

    lblFileNam = new Label();
    lblFileNam.setLocation(104, 0);
    lblFileNam.setSize(119, 25);
    lblFileNam.setText("FilePath:");
    getContentPane().add(lblFileNam);

    tfFilePat = new TextField();
    tfFilePat.setLocation(224, 0);
    tfFilePat.setSize(266, 25);
    tfFilePat.setBackground(new Color(-1));

    // OS Detection
    if (System.getProperty("os.name").startsWith("Windows")) {
      // includes: Windows 2000,  Windows 95, Windows 98, Windows NT, Windows Vista, Windows XP
      tfFilePat.setText("c:\\ics340\\words.txt");
      System.out.println("Detected Windows: " + System.getProperty("os.name"));
    } else {
      tfFilePat.setText("/Users/jasonedstrom/ics340/d1.txt");
      System.out.println("Detected Mac OS X: " + System.getProperty("os.name"));
    }

    tfFilePat.setColumns(10);
    getContentPane().add(tfFilePat);

    btLoadTextFiel = new JButton();
    btLoadTextFiel.setLocation(108, 50); // 108,27
    btLoadTextFiel.setSize(198, 32);
    btLoadTextFiel.setText("Load Words from Text Field");
    getContentPane().add(btLoadTextFiel);

    btLoadFil = new JButton();
    btLoadFil.setLocation(306, 50); // 306,27
    btLoadFil.setSize(183, 32);
    btLoadFil.setText("Load Words from File");
    getContentPane().add(btLoadFil);

    btFindPat = new JButton();
    btFindPat.setLocation(106, 160);
    btFindPat.setSize(384, 38);
    btFindPat.setText("Find Path");
    getContentPane().add(btFindPat);

    lblDictCoun = new JLabel();
    lblDictCoun.setLocation(108, 513);
    lblDictCoun.setSize(300, 27);
    lblDictCoun.setForeground(new Color(-65536));
    lblDictCoun.setText("Words in Dictionary = 0 words");
    getContentPane().add(lblDictCoun);

    lblIndexing1 = new JLabel();
    lblIndexing1.setLocation(107, 454);
    lblIndexing1.setSize(130, 27);
    lblIndexing1.setForeground(new Color(-16777216));
    lblIndexing1.setText("");
    getContentPane().add(lblIndexing1);

    lblFindPat = new JLabel();
    lblFindPat.setLocation(108, 540);
    lblFindPat.setSize(250, 27);
    lblFindPat.setForeground(new Color(-14646771));
    lblFindPat.setText("Time to find Path: 0 milliseconds");
    getContentPane().add(lblFindPat);

    lblCos = new JLabel();
    lblCos.setLocation(360, 540);
    lblCos.setSize(175, 27);
    lblCos.setForeground(new Color(-16777216));
    lblCos.setText("Cost of Path: 0.0");
    getContentPane().add(lblCos);

    lblProgres = new JLabel();
    lblProgres.setLocation(108, 484);
    lblProgres.setSize(371, 26);
    lblProgres.setForeground(new Color(-14646771));
    lblProgres.setText("Time to Build Graph: 0 milliseconds");
    getContentPane().add(lblProgres);

    testpanel = new JPanel();
    testpanel.setLocation(106, 200);
    testpanel.setSize(350, 200);
    testpanel.setForeground(new Color(-14646771));
    // testpanel.setText("Test Location");
    getContentPane().add(testpanel);

    btClear = new JButton();
    btClear.setLocation(355, 513);
    btClear.setSize(125, 25);
    btClear.setText("Clear Results");
    getContentPane().add(btClear);

    // add actionlisteners to buttons
    btFindPat.addActionListener(this);
    btLoadTextFiel.addActionListener(this);
    btLoadFil.addActionListener(this);
    btClear.addActionListener(this);

    setTitle("WordLadderGUI");
    setSize(500, 600);
    setVisible(true);
    setResizable(false);
  }
Beispiel #19
0
  private void initComponents() {
    borderColor = BasicColors.bgcolors[Settings.getInstance().getTheme()];
    borderColorDarker = BasicColors.bgcolors_darker[Settings.getInstance().getTheme()];

    realPanel = new JPanel();
    realPanel.setLayout(null);

    header = new JPanel();
    header.setBounds(0, 0, 800, 30);
    realPanel.add(header);
    header.setOpaque(true);
    header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS));
    header.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 5));
    header.setBackground(borderColor);
    header.setForeground(BasicColors.COLOR_WHITE_TEXT);

    ImageIcon headerIcon = Main.getIcon("icon.png");
    this.setIconImage(headerIcon.getImage());
    headerIcon = Utils.scaleImage(headerIcon, 16, 16);
    JLabel headerLabel = new JLabel(headerIcon);
    headerLabel.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));
    header.add(headerLabel);

    header.add(Box.createRigidArea(new Dimension(8, 0)));

    ActionListener tabListener = (e) -> MainFrame.this.selectTab(e.getActionCommand());

    this.mainTab = new HeaderTab(C.i18n("launcher.title.main"));
    this.mainTab.setForeground(BasicColors.COLOR_WHITE_TEXT);
    this.mainTab.setBackground(borderColorDarker);
    this.mainTab.setActionCommand("main");
    this.mainTab.addActionListener(tabListener);
    header.add(this.mainTab);

    this.gameTab = new HeaderTab(C.i18n("launcher.title.game"));
    this.gameTab.setForeground(BasicColors.COLOR_WHITE_TEXT);
    this.gameTab.setBackground(borderColorDarker);
    this.gameTab.setIsActive(true);
    this.gameTab.setHorizontalTextPosition(10);
    this.gameTab.addActionListener(tabListener);
    this.gameTab.setActionCommand("game");
    header.add(this.gameTab);

    this.launcherTab = new HeaderTab(C.i18n("launcher.title.launcher"));
    this.launcherTab.setForeground(BasicColors.COLOR_WHITE_TEXT);
    this.launcherTab.setBackground(borderColorDarker);
    this.launcherTab.setLayout(null);
    this.launcherTab.addActionListener(tabListener);
    this.launcherTab.setActionCommand("launcher");
    header.add(this.launcherTab);

    header.add(Box.createHorizontalGlue());

    JPanel rightHeaderPanel = new JPanel();
    rightHeaderPanel.setOpaque(false);
    rightHeaderPanel.setLayout(new BoxLayout(rightHeaderPanel, BoxLayout.PAGE_AXIS));
    rightHeaderPanel.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));

    JPanel windowGadgetPanel = new JPanel();
    windowGadgetPanel.setOpaque(false);
    windowGadgetPanel.setLayout(new BoxLayout(windowGadgetPanel, BoxLayout.LINE_AXIS));
    windowGadgetPanel.setAlignmentX(1.0F);

    ImageIcon minimizeIcon = Main.getIcon("minimize.png");
    JButton minimizeButton = new JButton(minimizeIcon);
    minimizeButton.setBorder(BorderFactory.createEmptyBorder());
    minimizeButton.setContentAreaFilled(false);
    minimizeButton.setCursor(new Cursor(12));
    minimizeButton.setFocusable(false);
    minimizeButton.addActionListener((e) -> MainFrame.this.minimizeWindow());
    windowGadgetPanel.add(minimizeButton);

    ImageIcon closeIcon = Main.getIcon("close.png");
    JButton closeButton = new JButton(closeIcon);
    closeButton.setBorder(BorderFactory.createEmptyBorder());
    closeButton.setContentAreaFilled(false);
    closeButton.addActionListener((e) -> MainFrame.this.closeWindow());
    closeButton.setCursor(new Cursor(12));
    closeButton.setFocusable(false);
    windowGadgetPanel.add(closeButton);

    rightHeaderPanel.add(windowGadgetPanel);

    windowTitle = new JLabel(defaultTitle);
    windowTitle.setForeground(BasicColors.COLOR_WHITE_TEXT);
    windowTitle.addMouseListener(
        new MouseListener() {

          @Override
          public void mouseClicked(MouseEvent e) {
            if (UpdateChecker.OUT_DATED) Main.update();
          }

          @Override
          public void mousePressed(MouseEvent e) {}

          @Override
          public void mouseReleased(MouseEvent e) {}

          @Override
          public void mouseEntered(MouseEvent e) {}

          @Override
          public void mouseExited(MouseEvent e) {}
        });
    header.add(windowTitle);
    header.add(Box.createHorizontalGlue());
    header.add(rightHeaderPanel);

    this.centralPanel = new TintablePanel();
    this.centralPanel.setTintColor(BasicColors.COLOR_CENTRAL_BACK);
    realPanel.add(this.centralPanel);
    JPanel truePanel = new JPanel();
    truePanel.setLayout(new BorderLayout());

    this.infoSwap = new JPanel();
    this.infoLayout = new CardLayout();
    this.infoSwap.setLayout(infoLayout);
    this.infoSwap.setOpaque(false);

    this.mainPanel = new MainPagePanel();
    this.infoSwap.add(mainPanel, "main");
    gamePanelWrapper = new JPanel();
    gamePanelWrapper.setLayout(new GridLayout());
    this.infoSwap.add(gamePanelWrapper, "game");
    launcherPanelWrapper = new JPanel();
    launcherPanelWrapper.setLayout(new GridLayout());
    this.infoSwap.add(launcherPanelWrapper, "launcher");

    truePanel.add(this.infoSwap, "Center");
    centralPanel.setLayout(null);
    centralPanel.add(truePanel);
    truePanel.setBounds(0, 0, 800, 480);
    centralPanel.setBounds(0, 30, 800, 480);

    setLayout(null);
    realPanel.setBounds(1, 0, 800, 511);
    add(realPanel);
  }
Beispiel #20
0
  public elementWrapper(String titleText, Component comp, vectorPanel parent, boolean editable) {
    if (comp == null) {
      throw new IllegalArgumentException("Error: Component parameter is null");
    }

    this.titleText = titleText;
    this.vp = parent;
    this.editable = editable;
    this.my_component = comp;

    debug = vp.gc.debug;

    if (debug) {
      System.err.println("Adding new elementWrapper");
    }

    setLayout(new BorderLayout());

    buttonPanel = new JPanel();
    buttonPanel.setOpaque(true);

    /*
    // set the border/button panel color based on the
    // object's validity

    checkValidation();

    */

    buttonPanel.setBackground(ClientColor.vectorTitles);
    setBorder(vp.wp.eWrapperBorder);

    buttonPanel.setForeground(ClientColor.vectorFore);
    buttonPanel.setLayout(new BorderLayout());

    if (editable) {
      remove = new JButton(vp.wp.removeImageIcon);
      remove.setOpaque(false);
      remove.setMargin(new Insets(0, 0, 0, 0));
      remove.setBorder(vp.wp.eWrapperButtonBorder);
      remove.setBorderPainted(false);

      // "Delete this element"
      remove.setToolTipText(ts.l("init.remove_tooltip"));
      remove.setContentAreaFilled(false);
      remove.addActionListener(this);
      remove.addFocusListener(this);
    }

    if (comp instanceof containerPanel) {
      if (titleText != null) {
        title = new JLabel(titleText);
      } else {
        // "Component"
        title = new JLabel(ts.l("init.default_label"));
      }

      title.setForeground(Color.white);
      title.addMouseListener(this);

      expand = new JButton(vp.wp.closeIcon);
      expand.setPressedIcon(vp.wp.closePressedIcon);
      expand.setMargin(new Insets(0, 0, 0, 0));
      expand.setBorder(vp.wp.eWrapperButtonBorder);
      expand.setBorderPainted(false);

      // "Expand this element"
      expand.setToolTipText(ts.l("global.expand_tooltip"));
      expand.setOpaque(false);
      expand.addActionListener(this);
      expand.addFocusListener(this);
      expand.setContentAreaFilled(false);

      buttonPanel.add("West", expand);
      buttonPanel.add("Center", title);

      if (editable) {
        buttonPanel.add("East", remove);
      }
    } else {
      if (titleText != null) {
        buttonPanel.add("West", new JLabel(titleText));
      }

      buttonPanel.add("Center", comp);

      if (editable) {
        buttonPanel.add("East", remove);
      }
    }

    add("North", buttonPanel);
  }
Beispiel #21
0
  /** Create the frame. */
  public SignInGUI() {
    super("Log In");
    setResizable(false);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 450, 300);
    contentPane = new JPanel();
    contentPane.setForeground(Color.PINK);
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);
    JLabel appNameIcon =
        new JLabel(new ImageIcon(this.getClass().getResource("/Picture/AppName.png")));
    appNameIcon.setBounds(79, 0, 300, 68);
    contentPane.add(appNameIcon);
    JLabel usrLbl = new JLabel("Username");
    usrLbl.setBounds(79, 101, 84, 28);
    contentPane.add(usrLbl);
    usrTextfld = new JTextField();
    usrTextfld.setBounds(180, 101, 205, 28);
    contentPane.add(usrTextfld);
    usrTextfld.setColumns(10);
    JLabel pwLbl = new JLabel("Password");
    pwLbl.setBounds(79, 147, 70, 15);
    contentPane.add(pwLbl);
    passwordField = new JPasswordField();
    passwordField.setBounds(180, 141, 205, 28);
    contentPane.add(passwordField);
    JButton signInBtn = new JButton("Sign In");
    signInBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String usr = usrTextfld.getText();
            String pass = new String(passwordField.getPassword());
            String query =
                "dataQuery(Account~*~UserName = '******' and PassWord = '******'~\"\"~\"\"~\"\"~\"\")";
            Account a = new Account();
            SQLConnection c = new SQLConnection();
            List<List<String>> accList = c.getAcc(usr, pass);
            String[][] x = SolveArrayList.ConvertFromArrayList(accList);
            if (x == null) {
              JOptionPane.showMessageDialog(null, "Your username or password is not correct");
            } else {
              a.setAID(x[0][0]);
              a.setUsername(x[0][1]);
              a.setPassword(x[0][2]);
              a.setFullname(x[0][3]);
              a.setBirthday(x[0][4]);
              a.setSex(x[0][5]);
              a.setPhonenumber(x[0][6]);
              new AccountGUI(a).setVisible(true);
              // dispose();
            }
          }
        });
    signInBtn.setBounds(303, 181, 82, 38);
    contentPane.add(signInBtn);
    JButton exitBtn = new JButton("Exit");
    exitBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ExitConfirm a = new ExitConfirm();
            a.setVisible(true);
          }
        });
    exitBtn.setBounds(180, 181, 90, 38);
    contentPane.add(exitBtn);

    JLabel lblSignUp = new JLabel("Sign Up");
    Font font = lblSignUp.getFont();
    lblSignUp.addMouseMotionListener(
        new MouseMotionAdapter() {
          @Override
          public void mouseMoved(MouseEvent e) {
            Map attributes = font.getAttributes();
            attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
            lblSignUp.setFont(font.deriveFont(attributes));
          }
        });
    lblSignUp.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            // new SignUpGUI().setVisible(true);
            // dispose();
          }

          @Override
          public void mouseExited(MouseEvent e) {
            lblSignUp.setFont(font);
          }
        });
    lblSignUp.setBounds(315, 250, 70, 15);
    contentPane.add(lblSignUp);
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.getContentPane().setBackground(Color.WHITE);
    frame.getContentPane().setForeground(Color.RED);
    frame.setBackground(Color.WHITE);
    frame.setBounds(100, 100, 613, 459);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setForeground(Color.BLACK);
    tabbedPane.setBackground(Color.WHITE);
    tabbedPane.setBounds(1, 2, 596, 408);
    frame.getContentPane().add(tabbedPane);

    JPanel panel_1 = new JPanel();
    panel_1.setBackground(Color.WHITE);
    panel_1.setForeground(Color.GREEN);
    tabbedPane.addTab("Recieved Mail", null, panel_1, null);
    panel_1.setLayout(null);

    JTextPane textPane_1 = new JTextPane();
    textPane_1.setBackground(Color.WHITE);
    textPane_1.setForeground(Color.BLACK);
    textPane_1.setEditable(false);

    JScrollPane scrollPane1 = new JScrollPane(textPane_1);
    scrollPane1.setBounds(150, 100, 420, 250);
    panel_1.add(scrollPane1);

    // panel_1.add(textPane_1);

    DefaultListModel listModel = new DefaultListModel();
    File[] files1 = new File("src/inbox").listFiles();
    for (File file : files1) {
      if (file.isFile())
        listModel.addElement((file.getName()).substring(0, (file.getName()).length() - 4));
    }

    JList list = new JList(listModel);
    list.setForeground(Color.BLACK);
    list.setBackground(Color.WHITE);

    // list.setBounds(10, 11, 112, 280);
    // panel_1.add(list);

    JScrollPane scrollPane = new JScrollPane(list);
    // scrollPane.setViewportView(list);
    scrollPane.setBounds(20, 11, 112, 340);
    panel_1.add(scrollPane);

    JLabel lblMessage = new JLabel("Message");
    lblMessage.setForeground(Color.BLACK);
    lblMessage.setBounds(175, 77, 79, 14);
    panel_1.add(lblMessage);

    JPanel panel = new JPanel();
    panel.setBackground(Color.WHITE);
    tabbedPane.addTab("Send Email", null, panel, null);
    panel.setLayout(null);

    JComboBox contactCombo = new JComboBox();
    contactCombo.setForeground(Color.BLACK);
    contactCombo.setBackground(Color.WHITE);
    contactCombo.setBounds(172, 21, 409, 20);
    panel.add(contactCombo);

    JLabel label = new JLabel("Message:");
    label.setForeground(Color.BLACK);
    label.setBounds(13, 117, 91, 14);
    panel.add(label);

    JTextPane messagePane = new JTextPane();
    messagePane.setBackground(Color.WHITE);
    messagePane.setForeground(Color.BLACK);
    messagePane.setBounds(10, 124, 539, 194);
    // panel.add(messagePane);

    JButton button_1 = new JButton("Send");
    button_1.setForeground(Color.BLACK);
    button_1.setBackground(Color.WHITE);
    button_1.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            String to = contactCombo.getSelectedItem().toString();
            String subject = txtSubject.getText();
            Random rn = new Random();
            String ShareID = Integer.toString((new Random()).nextInt((999999999 - 100) + 1) + 100);
            System.out.println(ShareID);
            String from = "src/proxies/proxies.txt";
            String message = messagePane.getText();
            try {
              // if(selectedFileIn == true)
              System.out.println("sendmail1");
              SendMail.Distributor(to, ShareID, from, message, "", subject);
              System.out.println("sendmail2");
              // selectedFileIn = false;
            } catch (IOException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
            messagePane.setText("");
            contactCombo.repaint();
            attField.setText("");
            attField.removeAll();
          }
        });

    JScrollPane sP =
        new JScrollPane(
            messagePane,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    sP.setBounds(13, 142, 568, 194);
    panel.add(sP);
    button_1.setBounds(482, 346, 99, 23);
    panel.add(button_1);

    JLabel lblTo = new JLabel("To");
    lblTo.setForeground(Color.BLACK);
    lblTo.setBackground(Color.BLACK);
    lblTo.setBounds(116, 24, 46, 14);
    panel.add(lblTo);

    attField = new JTextField();
    attField.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {}
        });
    attField.setBounds(172, 52, 409, 20);
    panel.add(attField);
    attField.setColumns(10);

    JButton btnSearchButton = new JButton("Search");
    btnSearchButton.setBackground(Color.WHITE);
    btnSearchButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.showOpenDialog(frame);
            // fileChooser.setCurrentDirectory(new File(System.getProperty("src/")));
            selectedFile = fileChooser.getSelectedFile();
            attField.setText(selectedFile.getName());
            selectedFileIn = true;
            // selectedFile = fileChooser.getSelectedFile();
          }
        });
    btnSearchButton.setBounds(73, 51, 89, 23);
    panel.add(btnSearchButton);

    txtSubject = new JTextField();
    txtSubject.setBounds(172, 83, 409, 20);
    panel.add(txtSubject);
    txtSubject.setColumns(10);

    JLabel lblSubject = new JLabel("Subject");
    lblSubject.setForeground(Color.BLACK);
    lblSubject.setBackground(Color.BLACK);
    lblSubject.setBounds(116, 85, 46, 14);
    panel.add(lblSubject);

    JPanel panel_2 = new JPanel();
    panel_2.setBackground(Color.WHITE);
    tabbedPane.addTab("Add Contact", null, panel_2, null);
    panel_2.setLayout(null);

    JLabel lblEmailAddress = new JLabel("Email Address");
    lblEmailAddress.setForeground(Color.BLACK);
    lblEmailAddress.setBounds(75, 159, 72, 14);
    panel_2.add(lblEmailAddress);

    JTextPane proxyPane = new JTextPane();
    proxyPane.setForeground(Color.BLACK);
    proxyPane.setBackground(Color.LIGHT_GRAY);
    proxyPane.setBounds(157, 159, 298, 102);
    panel_2.add(proxyPane);

    JLabel lblContactName = new JLabel("Contact Name");
    lblContactName.setForeground(Color.BLACK);
    lblContactName.setBounds(69, 124, 72, 14);
    panel_2.add(lblContactName);

    contactField = new JTextField();
    contactField.setBackground(Color.LIGHT_GRAY);
    contactField.setColumns(10);
    contactField.setBounds(157, 121, 298, 20);
    panel_2.add(contactField);

    JButton btnAddContact = new JButton("Add Contact");
    btnAddContact.setBackground(Color.WHITE);
    btnAddContact.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            BufferedWriter output = null;
            // Add new contact
            String conName = contactField.getText();
            String allprox = proxyPane.getText();
            File conFile = new File("src/contacts/" + conName + ".txt");
            try {
              output = new BufferedWriter(new FileWriter(conFile));
              output.write(allprox);
              output.close();
            } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        });
    btnAddContact.setBounds(157, 301, 118, 23);
    panel_2.add(btnAddContact);

    // List<String> contacts = new ArrayList<String>();
    // comboBox.addItem("hg");
    File[] files = new File("src/contacts").listFiles();
    for (File file : files) {
      if (file.isFile())
        contactCombo.addItem((file.getName()).substring(0, (file.getName()).length() - 4));
    }
    list.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            String strbldr = "";
            String loc = "src/inbox/" + list.getSelectedValue().toString() + ".txt";
            try {
              BufferedReader buffread = new BufferedReader(new FileReader(loc));
              String line = buffread.readLine();
              while (line != null) {
                strbldr += line;
                strbldr += "\n";
                line = buffread.readLine();
              }
              buffread.close();
            } catch (Exception e) {
            }
            ;
            textPane_1.setText(strbldr);
            textPane_1.setCaretPosition(0);
          }
        });
    class Inner extends Thread {

      public void run() {

        do {
          System.out.println("Hello from a thread!");
          try {
            ReceiveMail.run();
            scrollPane.repaint();
            this.sleep(10000);
          } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        } while (true);
      }

      public void main(String args[]) {
        (new Inner()).start();
      }
    }
    Inner reloads = new Inner();
    reloads.start();
  }
  /** Create the frame. */
  protected UserInterface() {

    setTitle("ImageSimilarity");
    setBackground(Color.DARK_GRAY);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 731, 503);

    contentPane = new JPanel();
    contentPane.setForeground(Color.LIGHT_GRAY);
    contentPane.setBackground(Color.BLACK);
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS));

    JPanel panel = new JPanel();
    panel.setBackground(Color.DARK_GRAY);
    contentPane.add(panel);
    panel.setLayout(null);

    lblNewLabel = new JLabel("Please select .jpg reference image");
    lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
    lblNewLabel.setForeground(Color.WHITE);
    lblNewLabel.setBounds(12, 49, 302, 14);
    panel.add(lblNewLabel);

    lblNewLabel_1 = new JLabel("Please select directory with images to compare with");
    lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER);
    lblNewLabel_1.setForeground(Color.WHITE);
    lblNewLabel_1.setBounds(336, 49, 356, 14);
    panel.add(lblNewLabel_1);

    // Progress bar <3
    progressBar = new JProgressBar();
    progressBar.setForeground(Color.RED);
    progressBar.setBounds(12, 74, 680, 14);
    panel.add(progressBar);

    fcf.setFileSelectionMode(JFileChooser.FILES_ONLY);
    fcf.setFileFilter(new JPEGFilter());
    fcd.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    // Panel with buttons
    JPanel panel_1 = new JPanel();
    panel_1.setBackground(Color.DARK_GRAY);
    panel_1.setBounds(12, 5, 680, 33);
    panel.add(panel_1);

    btnSelectImage = new JButton("Select Reference Image");
    btnSelectImagesTo = new JButton("Select Images to Compare with");
    btnStartImageSimilarity = new JButton("Calculate Image Similarity");

    // Get reference image
    btnSelectImage.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int returnVal = fcf.showOpenDialog(UserInterface.this);

            if (returnVal == JFileChooser.APPROVE_OPTION) {
              image = fcf.getSelectedFile();
              is.setImage(image);
              lblNewLabel.setText(image.getAbsolutePath());

              panel_3.create(image, 200, 200);
              panel_3.repaint();
              panel_2.repaint();
            }

            if (is.ifFiles()) {
              btnStartImageSimilarity.setEnabled(true);
            } else {
              btnStartImageSimilarity.setEnabled(false);
            }
          }
        });
    panel_1.add(btnSelectImage);

    // Get images to compare with
    btnSelectImagesTo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            int returnVal = fcd.showOpenDialog(UserInterface.this);

            if (returnVal == JFileChooser.APPROVE_OPTION) {
              directory = fcd.getSelectedFile();
              is.setDirectory(directory);
              lblNewLabel_1.setText(directory.getAbsolutePath());
            }

            if (is.ifFiles()) {
              btnStartImageSimilarity.setEnabled(true);
            } else {
              btnStartImageSimilarity.setEnabled(false);
            }
          }
        });
    panel_1.add(btnSelectImagesTo);

    // Run ImageSimilarity algorithm
    btnStartImageSimilarity.setEnabled(false);
    btnStartImageSimilarity.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            UserInterface.getInstance().clearThumbnails();

            thread = new Thread(new Run());
            thread.start();
          }
        });
    panel_1.add(btnStartImageSimilarity);

    panel_2 = new JPanel();
    panel_2.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panel_2.setBackground(Color.DARK_GRAY);
    panel_2.setBounds(12, 99, 220, 344);
    panel.add(panel_2);
    panel_2.setLayout(null);

    panel_3 = new ImagePanel();
    panel_3.setBackground(Color.DARK_GRAY);
    panel_3.setBounds(10, 11, 200, 200);
    panel_2.add(panel_3);

    panel_4 = new JPanel();
    panel_4.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_4.setBackground(Color.DARK_GRAY);
    panel_4.setBounds(242, 99, 450, 344);
    panel.add(panel_4);
    panel_4.setLayout(null);

    scrollPane_1 = new JScrollPane();
    scrollPane_1.setToolTipText("test");
    scrollPane_1.setBounds(428, 335, -419, -328);
    panel_4.add(scrollPane_1);
  }
Beispiel #24
0
  /** Initialize the contents of the frame. */
  private void initialize() {

    frmDistributedbox = new JFrame();
    frmDistributedbox.setTitle("DistributedBox");
    frmDistributedbox.setBounds(100, 100, 899, 654);
    frmDistributedbox.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    ClientConnector.getInstance().addObserver(this);

    JMenuBar menuBar = new JMenuBar();
    frmDistributedbox.setJMenuBar(menuBar);

    final JMenu mnConnection = new JMenu("Connexion");
    menuBar.add(mnConnection);

    final JMenuItem menuItemConnect = new JMenuItem("Connecte");

    mnConnection.add(menuItemConnect);

    JPanel panelButtons = new JPanel();

    JPanel pnlConnection = new JPanel();
    pnlConnection.setForeground(Color.RED);

    final JPanel panelItems = new JPanel();

    JPanel PanelItems = new JPanel();

    JPanel panel = new JPanel();

    JPanel panel_1 = new JPanel();
    GroupLayout groupLayout = new GroupLayout(frmDistributedbox.getContentPane());
    groupLayout.setHorizontalGroup(
        groupLayout
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                groupLayout
                    .createSequentialGroup()
                    .addGap(11)
                    .addComponent(
                        panelItems, GroupLayout.PREFERRED_SIZE, 290, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(
                        groupLayout
                            .createParallelGroup(Alignment.LEADING, false)
                            .addGroup(
                                groupLayout
                                    .createSequentialGroup()
                                    .addComponent(
                                        panelButtons,
                                        GroupLayout.PREFERRED_SIZE,
                                        105,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addGroup(
                                        groupLayout
                                            .createParallelGroup(Alignment.LEADING, false)
                                            .addComponent(
                                                pnlConnection,
                                                GroupLayout.DEFAULT_SIZE,
                                                411,
                                                Short.MAX_VALUE)
                                            .addComponent(
                                                panel_1,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .addComponent(
                                                panel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)))
                            .addComponent(
                                PanelItems,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addContainerGap(38, GroupLayout.PREFERRED_SIZE)));
    groupLayout.setVerticalGroup(
        groupLayout
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                groupLayout
                    .createSequentialGroup()
                    .addGroup(
                        groupLayout
                            .createParallelGroup(Alignment.LEADING)
                            .addComponent(
                                panelItems, GroupLayout.DEFAULT_SIZE, 561, Short.MAX_VALUE)
                            .addGroup(
                                groupLayout
                                    .createSequentialGroup()
                                    .addGroup(
                                        groupLayout
                                            .createParallelGroup(Alignment.LEADING)
                                            .addGroup(
                                                groupLayout
                                                    .createSequentialGroup()
                                                    .addContainerGap()
                                                    .addComponent(
                                                        pnlConnection,
                                                        GroupLayout.DEFAULT_SIZE,
                                                        GroupLayout.DEFAULT_SIZE,
                                                        Short.MAX_VALUE)
                                                    .addPreferredGap(ComponentPlacement.RELATED)
                                                    .addComponent(
                                                        panel_1,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        GroupLayout.DEFAULT_SIZE,
                                                        GroupLayout.PREFERRED_SIZE)
                                                    .addGap(11)
                                                    .addComponent(
                                                        panel,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        19,
                                                        Short.MAX_VALUE))
                                            .addComponent(
                                                panelButtons,
                                                GroupLayout.DEFAULT_SIZE,
                                                128,
                                                Short.MAX_VALUE))
                                    .addGap(21)
                                    .addComponent(
                                        PanelItems,
                                        GroupLayout.PREFERRED_SIZE,
                                        412,
                                        GroupLayout.PREFERRED_SIZE)))
                    .addGap(34)));
    panel_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    lblProgression = new JLabel("transfert du fichier : ");
    lblProgression.setHorizontalAlignment(SwingConstants.CENTER);
    lblProgression.setForeground(Color.BLACK);
    panel_1.add(lblProgression);
    panel.setLayout(new BorderLayout(0, 0));

    progressBar = new JProgressBar();
    progressBar.setValue(0);
    panel.add(progressBar);
    PanelItems.setLayout(new BorderLayout(0, 0));

    JScrollPane scrollPane = new JScrollPane();
    PanelItems.add(scrollPane);

    final JTextArea txtLogs = new JTextArea();
    txtLogs.setEditable(false);
    txtLogs.setText("Connectez-vous au name node pour d�buter");
    scrollPane.setViewportView(txtLogs);
    pnlConnection.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    lblConnexion = new JLabel("D�connect�");
    lblConnexion.setForeground(Color.RED);
    lblConnexion.setHorizontalAlignment(SwingConstants.CENTER);
    pnlConnection.add(lblConnexion);
    panelItems.setLayout(new BorderLayout(0, 0));

    JScrollPane ScrollPanelItems = new JScrollPane();
    panelItems.add(ScrollPanelItems);

    treeItems.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            int row = treeItems.getRowForLocation(arg0.getX(), arg0.getY());
            if (row == -1) treeItems.clearSelection();
          }
        });

    treeItems.setVisibleRowCount(21);
    ScrollPanelItems.setViewportView(treeItems);
    treeItems.setEditable(true);
    treeItems.setBackground(Color.WHITE);
    treeItems.setModel(
        new DefaultTreeModel(
            new DefaultMutableTreeNode("DisBox") {
              {
              }
            }));
    panelButtons.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    final JButton btnAjouter = new JButton("Ajout");

    btnAjouter.setEnabled(false);
    btnAjouter.setHorizontalAlignment(SwingConstants.RIGHT);
    panelButtons.add(btnAjouter);

    final JButton btnSupprimer = new JButton("Supp");

    btnSupprimer.setEnabled(false);

    btnSupprimer.setHorizontalAlignment(SwingConstants.RIGHT);
    panelButtons.add(btnSupprimer);

    final JButton btnOuvrir = new JButton("Ouvrir");
    btnOuvrir.setEnabled(false);

    btnOuvrir.setHorizontalAlignment(SwingConstants.RIGHT);
    btnOuvrir.setEnabled(false);
    panelButtons.add(btnOuvrir);
    frmDistributedbox.getContentPane().setLayout(groupLayout);
    treeItems.addTreeSelectionListener(
        new TreeSelectionListener() {
          public void valueChanged(TreeSelectionEvent e) {
            System.out.println("something happens");
            boolean somethingIsSelected = !(treeItems.isSelectionEmpty());
            btnSupprimer.setEnabled(somethingIsSelected);
            btnOuvrir.setEnabled(somethingIsSelected);
          }
        });
    btnAjouter.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
            int returnVal = chooser.showOpenDialog(new JFrame());
            DefaultMutableTreeNode selectedNode =
                (DefaultMutableTreeNode) treeItems.getLastSelectedPathComponent();

            String dossierParent = " ";
            // rebuild du open au niveau du selected Node
            if (selectedNode != null) {

              if (!(selectedNode.toString().equals("DisBox"))) {
                dossierParent = "";
                String temp = rebuildNodeString(selectedNode);
                System.out.println(temp);
                if (temp.contains("\\")) {

                  String[] tempSplit = temp.replace("\\", "/").split("/");
                  for (int i = 0; i < tempSplit.length; i++) {

                    if (!tempSplit[i].contains(".")) {

                      if (i != 0) {
                        dossierParent += "\\";
                      }
                      dossierParent += tempSplit[i];
                    }
                  }
                } else if (selectedNode.getChildCount() > 0) {
                  dossierParent += selectedNode.toString() + "\\";
                }
              }
            }
            if (returnVal == JFileChooser.APPROVE_OPTION) {
              File fichierOuDossier = chooser.getSelectedFile();
              txtLogs.append("\nFichier s�lectionn�, envoi en cours");

              recurseFolder(cc, fichierOuDossier, dossierParent);

            } else {
              txtLogs.append("\najout annul� par l'utilisateur");
            }
          }
        });
    btnSupprimer.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            // rebuild chemin du node root\\dossier1\\fichier
            DefaultMutableTreeNode selectedNode =
                (DefaultMutableTreeNode) treeItems.getLastSelectedPathComponent();

            String rebuild = rebuildNodeString(selectedNode);

            System.out.println(rebuild);
            cc.deleteFile(rebuild);

            txtLogs.append("\nSupression de l'�l�ment, " + rebuild);
          }
        });
    btnOuvrir.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {

            DefaultMutableTreeNode selectedNode =
                (DefaultMutableTreeNode) treeItems.getLastSelectedPathComponent();
            String rebuild = rebuildNodeString(selectedNode);

            cc.readFile(rebuild);
          }
        });
    menuItemConnect.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {

            if (isConnected) {
              isConnected = false;

              // kill connection
              // cc.setServerConnectedTo(null); //??

              // change name of button back to Connect
              mnConnection.setText("Connecte");
              lblConnexion.setText("D�connect�");
              lblConnexion.setForeground(Color.RED);

            } else {
              // popup avec info du nameNode -- needed?

              String connectionString =
                  (String)
                      JOptionPane.showInputDialog(
                          new JFrame(),
                          "Entrez les informations de connexions pour le NameNode",
                          "Connexion..",
                          JOptionPane.PLAIN_MESSAGE,
                          null,
                          null,
                          "localhost:10111");

              // If a string was returned
              if ((connectionString != null)
                  && (connectionString.length() > 0)
                  && (connectionString.contains(":"))) {
                // extract IPAdress, portNumber
                String hostname = connectionString.split(":")[0];
                Inet4Address ip;
                int port;
                try {
                  ip = (Inet4Address) Inet4Address.getByName(hostname);
                  port = Integer.parseInt(connectionString.split(":")[1]);
                  System.out.println("connecting to " + ip.toString() + " on the port " + port);
                  // connect to nameNode, server infos will be
                  // dispatched
                  cc.ConnectToFileSystem(ip, port);

                  // Connect to Server
                  txtLogs.setText("");
                  txtLogs.append("Connexion �tablie avec le serveur");

                  // set isConnected True
                  isConnected = true;
                  cc.getListFileAvailaible();
                  lblConnexion.setText("Connecte");
                  lblConnexion.setForeground(Color.GREEN);
                  mnConnection.setText("Deconnecte");
                  // refresh treeItems
                } catch (Exception e) {
                  txtLogs.append(
                      "\nEchec de connexion, "
                          + connectionString
                          + " n'est pas une connexion valide");
                }

              } else {
                txtLogs.append(
                    "\nEchec de connexion, "
                        + connectionString
                        + " n'est pas une connexion valide");
              }
            }
            btnAjouter.setEnabled(isConnected);
          }
        });
  }
  /** Sets up the GUI (panels, buttons, etc) and displays it on the screen. */
  private void init() {
    DecimalFormat df;
    int xUnits;
    String unitStr;
    String distStr;
    setForeground(Color.black);
    setTitle("Center Distances version 2  07/14/08");

    df = new DecimalFormat("0.000E0");

    GridBagConstraints gbc = new GridBagConstraints();
    int yPos = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.weightx = 1;
    gbc.insets = new Insets(3, 3, 3, 3);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 0;
    gbc.gridy = yPos++;

    JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.setForeground(Color.black);
    mainPanel.setBorder(buildTitledBorder("Input parameters"));

    blueMinLabel = new JLabel("Minimum number of blue pixels per nucleus");
    blueMinLabel.setForeground(Color.black);
    blueMinLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(blueMinLabel, gbc);

    blueMinText = new JTextField(5);
    if (image.getNDims() == 2) {
      blueMinText.setText("1000");
    } else {
      blueMinText.setText("20000");
    }
    blueMinText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(blueMinText, gbc);

    redMinLabel = new JLabel("Minimum red pixel count");
    redMinLabel.setForeground(Color.black);
    redMinLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(redMinLabel, gbc);

    redMinText = new JTextField(5);
    redMinText.setText("50");
    redMinText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(redMinText, gbc);

    redFractionLabel = new JLabel("Fraction of red pixels to consider");
    redFractionLabel.setForeground(Color.black);
    redFractionLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(redFractionLabel, gbc);

    redFractionText = new JTextField(5);
    redFractionText.setText("0.15");
    redFractionText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(redFractionText, gbc);

    xUnits = image.getFileInfo(0).getUnitsOfMeasure()[0];
    if (xUnits != Unit.UNKNOWN_MEASURE.getLegacyNum()) {
      unitStr = (Unit.getUnitFromLegacyNum(xUnits)).toString();
      greenMergingLabel = new JLabel("Green merging radius around peak (" + unitStr + ")");
    } else {
      greenMergingLabel = new JLabel("Green merging radius around peak");
    }
    greenMergingLabel.setForeground(Color.black);
    greenMergingLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(greenMergingLabel, gbc);

    if (image.getNDims() == 2) {
      // mergingDistance = 8.0f * image.getFileInfo(0).getResolutions()[0];
      mergingDistance = 0.0f;
    } else {
      // mergingDistance = 4.0f * image.getFileInfo(0).getResolutions()[0];
      mergingDistance = 0.0f;
    }
    distStr = df.format(mergingDistance);
    greenMergingText = new JTextField(10);
    greenMergingText.setText(distStr);
    greenMergingText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(greenMergingText, gbc);

    greenMinLabel = new JLabel("Minimum green pixel count");
    greenMinLabel.setForeground(Color.black);
    greenMinLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(greenMinLabel, gbc);

    greenMinText = new JTextField(5);
    greenMinText.setText("10");
    greenMinText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(greenMinText, gbc);

    greenFractionLabel = new JLabel("Fraction of green pixels to consider");
    greenFractionLabel.setForeground(Color.black);
    greenFractionLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(greenFractionLabel, gbc);

    greenFractionText = new JTextField(5);
    greenFractionText.setText("0.01");
    greenFractionText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(greenFractionText, gbc);

    greenRegionsLabel = new JLabel("Green regions per cell");
    greenRegionsLabel.setForeground(Color.black);
    greenRegionsLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(greenRegionsLabel, gbc);

    JPanel buttonPanel = new JPanel(new GridBagLayout());

    greenGroup = new ButtonGroup();

    oneButton = new JRadioButton("1", false);
    oneButton.setForeground(Color.black);
    oneButton.setFont(serif12);
    greenGroup.add(oneButton);
    gbc.gridx = 0;
    gbc.gridy = 0;
    buttonPanel.add(oneButton, gbc);

    twoButton = new JRadioButton("2", true);
    twoButton.setForeground(Color.black);
    twoButton.setFont(serif12);
    greenGroup.add(twoButton);
    gbc.gridx = 1;
    gbc.gridy = 0;
    buttonPanel.add(twoButton, gbc);

    threeButton = new JRadioButton("3", false);
    threeButton.setForeground(Color.black);
    threeButton.setFont(serif12);
    greenGroup.add(threeButton);
    gbc.gridx = 2;
    gbc.gridy = 0;
    buttonPanel.add(threeButton, gbc);

    fourButton = new JRadioButton("4", false);
    fourButton.setForeground(Color.black);
    fourButton.setFont(serif12);
    greenGroup.add(fourButton);
    gbc.gridx = 3;
    gbc.gridy = 0;
    buttonPanel.add(fourButton, gbc);

    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(buttonPanel, gbc);

    twoBox = new JCheckBox("Use 2 top gray levels in green segmentation", true);
    twoBox.setForeground(Color.black);
    twoBox.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos++;
    mainPanel.add(twoBox, gbc);

    blueValueLabel =
        new JLabel("Fraction of blue transition from image min to max at nucleus boundary");
    blueValueLabel.setForeground(Color.black);
    blueValueLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(blueValueLabel, gbc);

    blueValueText = new JTextField(5);
    blueValueText.setText("0.15");
    blueValueText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(blueValueText, gbc);

    blueSmoothBox = new JCheckBox("Smooth blue VOI contours with AlgorithmBSmooth", true);
    blueSmoothBox.setForeground(Color.black);
    blueSmoothBox.setFont(serif12);
    blueSmoothBox.addActionListener(this);
    gbc.gridx = 0;
    gbc.gridy = yPos++;
    mainPanel.add(blueSmoothBox, gbc);

    interpolationLabel = new JLabel("Number of interpolation points determined by divisor (> 1.0)");
    interpolationLabel.setForeground(Color.black);
    interpolationLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(interpolationLabel, gbc);

    interpolationText = new JTextField(5);
    interpolationText.setText("24.0");
    interpolationText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(interpolationText, gbc);

    getContentPane().add(mainPanel, BorderLayout.CENTER);
    getContentPane().add(buildButtons(), BorderLayout.SOUTH);

    pack();
    setVisible(true);
    setResizable(false);
    System.gc();
  } // end init()
Beispiel #26
0
  private void SetupUI(String loginID) {
    chatFrame = new JFrame("Chat " + loginID);
    PrivateMessageDialog = new JDialog(chatFrame, true);
    PvtMsgPanel = new javax.swing.JPanel();
    SendPrivate = new javax.swing.JButton();
    PrivateInput = new javax.swing.JTextArea();
    PvtUserId = new javax.swing.JTextField();
    RecipientLabel = new javax.swing.JLabel();
    MessageLabel = new javax.swing.JLabel();
    MainWindowTabs = new javax.swing.JTabbedPane();
    ChatWindow = new javax.swing.JPanel();
    ChatDisplayScroll = new javax.swing.JScrollPane();
    MessageDisplay = new javax.swing.JTextArea();
    MessageScroll = new javax.swing.JScrollPane();
    MessageInput = new javax.swing.JTextArea();
    Send = new javax.swing.JButton();
    PrivateMsg = new javax.swing.JButton();
    DrawPadButton = new javax.swing.JButton();
    Availability = new javax.swing.JToggleButton();
    SettingsWindow = new javax.swing.JPanel();
    settingsChatPanel = new javax.swing.JPanel();
    SetChannelButton = new javax.swing.JButton();
    ChannelToSetTo = new javax.swing.JTextField();
    ForwardTo = new javax.swing.JTextField();
    ForwardButton = new javax.swing.JButton();
    blockPanel = new javax.swing.JPanel();
    WhoIBlockButton = new javax.swing.JButton();
    BlockButton = new javax.swing.JButton();
    WhoBlocksMeButton = new javax.swing.JButton();
    UnblockButton = new javax.swing.JButton();
    UserToChangeBlock = new javax.swing.JTextField();
    networkPanel = new javax.swing.JPanel();
    PortInput = new javax.swing.JTextField();
    SetPortButton = new javax.swing.JButton();
    HostInput = new javax.swing.JTextField();
    SetHostButton = new javax.swing.JButton();
    GetHost = new javax.swing.JButton();
    GetPort = new javax.swing.JButton();

    // Customize Form
    Send.setBackground(Color.decode("#16A085"));
    SendPrivate.setBackground(Color.decode("#16A085"));
    Availability.setBackground(Color.decode("#2ECC71"));
    MessageDisplay.setEditable(false);
    PrivateMessageDialog.setSize(405, 335);

    chatFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    chatFrame.setBackground(new java.awt.Color(52, 73, 94));

    MainWindowTabs.setBackground(new java.awt.Color(44, 62, 80));
    MainWindowTabs.setOpaque(true);

    // Netbeans
    PvtMsgPanel.setBackground(new java.awt.Color(52, 73, 94));
    SendPrivate.setText("Send");
    PrivateInput.setBackground(new java.awt.Color(127, 140, 141));
    PrivateInput.setColumns(20);
    PrivateInput.setFont(new java.awt.Font("Arial", 0, 13));
    PrivateInput.setLineWrap(true);
    PrivateInput.setRows(5);
    PvtUserId.setBackground(new java.awt.Color(127, 140, 141));
    RecipientLabel.setForeground(new java.awt.Color(240, 240, 240));
    RecipientLabel.setText("Recipient Id:");
    MessageLabel.setForeground(new java.awt.Color(240, 240, 240));
    MessageLabel.setText("Message:");

    javax.swing.GroupLayout PvtMsgPanelLayout = new javax.swing.GroupLayout(PvtMsgPanel);
    PvtMsgPanel.setLayout(PvtMsgPanelLayout);
    PvtMsgPanelLayout.setHorizontalGroup(
        PvtMsgPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                PvtMsgPanelLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        PvtMsgPanelLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(PvtUserId)
                            .addGroup(
                                PvtMsgPanelLayout.createParallelGroup(
                                        javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(
                                        SendPrivate,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        128,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(
                                        PvtMsgPanelLayout.createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addComponent(
                                                PrivateInput,
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(
                                                PvtMsgPanelLayout.createSequentialGroup()
                                                    .addComponent(RecipientLabel)
                                                    .addGap(310, 310, 310))))
                            .addComponent(MessageLabel))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    PvtMsgPanelLayout.setVerticalGroup(
        PvtMsgPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                PvtMsgPanelLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(RecipientLabel)
                    .addGap(1, 1, 1)
                    .addComponent(
                        PvtUserId,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(MessageLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        PrivateInput,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        168,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        SendPrivate,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        35,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    javax.swing.GroupLayout PrivateMessageDialogLayout =
        new javax.swing.GroupLayout(PrivateMessageDialog.getContentPane());
    PrivateMessageDialog.getContentPane().setLayout(PrivateMessageDialogLayout);
    PrivateMessageDialogLayout.setHorizontalGroup(
        PrivateMessageDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                PvtMsgPanel,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                Short.MAX_VALUE));
    PrivateMessageDialogLayout.setVerticalGroup(
        PrivateMessageDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                PrivateMessageDialogLayout.createSequentialGroup()
                    .addComponent(
                        PvtMsgPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 3, Short.MAX_VALUE)));

    MainWindowTabs.setBackground(new java.awt.Color(52, 73, 94));
    ChatWindow.setBackground(new java.awt.Color(52, 73, 94));
    ChatWindow.setPreferredSize(new java.awt.Dimension(430, 600));
    ChatWindow.setVerifyInputWhenFocusTarget(false);

    ChatDisplayScroll.setAutoscrolls(true);
    MessageDisplay.setEditable(false);
    MessageDisplay.setBackground(new java.awt.Color(127, 140, 141));
    MessageDisplay.setColumns(20);
    MessageDisplay.setFont(new java.awt.Font("Arial", 0, 13));
    MessageDisplay.setLineWrap(true);
    MessageDisplay.setRows(5);
    ChatDisplayScroll.setViewportView(MessageDisplay);

    MessageInput.setBackground(new java.awt.Color(127, 140, 141));
    MessageInput.setColumns(2);
    MessageInput.setLineWrap(true);
    MessageInput.setRows(3);
    MessageScroll.setViewportView(MessageInput);

    Send.setText("Send");
    PrivateMsg.setText("Private Message");
    DrawPadButton.setText("Draw Pad");
    Availability.setText("Available");

    javax.swing.GroupLayout ChatWindowLayout = new javax.swing.GroupLayout(ChatWindow);
    ChatWindow.setLayout(ChatWindowLayout);
    ChatWindowLayout.setHorizontalGroup(
        ChatWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                ChatWindowLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        ChatWindowLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                ChatDisplayScroll, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                ChatWindowLayout.createSequentialGroup()
                                    .addComponent(MessageScroll)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        Send,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        85,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                ChatWindowLayout.createSequentialGroup()
                                    .addComponent(
                                        DrawPadButton,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        122,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(
                                        PrivateMsg,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        146,
                                        Short.MAX_VALUE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(
                                        Availability,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        122,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()));
    ChatWindowLayout.setVerticalGroup(
        ChatWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                ChatWindowLayout.createSequentialGroup()
                    .addGap(7, 7, 7)
                    .addComponent(
                        ChatDisplayScroll,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        289,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        ChatWindowLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                MessageScroll,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                67,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                Send,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        ChatWindowLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(DrawPadButton)
                            .addComponent(PrivateMsg)
                            .addComponent(Availability))
                    .addContainerGap()));

    MainWindowTabs.addTab("Chat", ChatWindow);
    SettingsWindow.setBackground(new java.awt.Color(52, 73, 94));
    settingsChatPanel.setBackground(new java.awt.Color(52, 73, 94));
    settingsChatPanel.setBorder(
        javax.swing.BorderFactory.createTitledBorder(
            new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED),
            "Chat",
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION,
            null,
            new java.awt.Color(240, 240, 240)));

    SetChannelButton.setText("Set Channel");
    SetChannelButton.setBorderPainted(false);
    ChannelToSetTo.setBackground(new java.awt.Color(127, 140, 141));
    ForwardTo.setBackground(new java.awt.Color(127, 140, 141));

    ForwardButton.setText("Forward");
    ForwardButton.setBorderPainted(false);

    javax.swing.GroupLayout settingsChatPanelLayout =
        new javax.swing.GroupLayout(settingsChatPanel);
    settingsChatPanel.setLayout(settingsChatPanelLayout);
    settingsChatPanelLayout.setHorizontalGroup(
        settingsChatPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                settingsChatPanelLayout
                    .createSequentialGroup()
                    .addContainerGap(80, Short.MAX_VALUE)
                    .addGroup(
                        settingsChatPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(
                                javax.swing.GroupLayout.Alignment.LEADING,
                                settingsChatPanelLayout
                                    .createSequentialGroup()
                                    .addComponent(
                                        ChannelToSetTo,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        151,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(SetChannelButton))
                            .addGroup(
                                javax.swing.GroupLayout.Alignment.LEADING,
                                settingsChatPanelLayout
                                    .createSequentialGroup()
                                    .addComponent(
                                        ForwardTo,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        151,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        ForwardButton,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)))
                    .addContainerGap(68, Short.MAX_VALUE)));
    settingsChatPanelLayout.setVerticalGroup(
        settingsChatPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                settingsChatPanelLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        settingsChatPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                ChannelToSetTo,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(SetChannelButton))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        settingsChatPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ForwardButton)
                            .addComponent(
                                ForwardTo,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    blockPanel.setBackground(new java.awt.Color(52, 73, 94));
    blockPanel.setBorder(
        javax.swing.BorderFactory.createTitledBorder(
            new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED),
            "Block",
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION,
            null,
            new java.awt.Color(240, 240, 240)));
    blockPanel.setForeground(new java.awt.Color(255, 255, 255));

    WhoIBlockButton.setText("My Blocks");
    BlockButton.setBorderPainted(false);
    BlockButton.setText("Block");
    WhoBlocksMeButton.setText("Blocks Me");
    UnblockButton.setText("Unblock");
    UnblockButton.setActionCommand("Unblock");
    UnblockButton.setBorderPainted(false);

    UserToChangeBlock.setBackground(new java.awt.Color(127, 140, 141));

    javax.swing.GroupLayout blockPanelLayout = new javax.swing.GroupLayout(blockPanel);
    blockPanel.setLayout(blockPanelLayout);
    blockPanelLayout.setHorizontalGroup(
        blockPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                blockPanelLayout
                    .createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(
                        UserToChangeBlock,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        151,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        blockPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                blockPanelLayout
                                    .createSequentialGroup()
                                    .addComponent(
                                        BlockButton,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        75,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(WhoIBlockButton))
                            .addGroup(
                                blockPanelLayout
                                    .createSequentialGroup()
                                    .addComponent(
                                        UnblockButton,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        75,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(WhoBlocksMeButton)))
                    .addGap(23, 23, 23)));
    blockPanelLayout.setVerticalGroup(
        blockPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                blockPanelLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        blockPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                blockPanelLayout
                                    .createSequentialGroup()
                                    .addGroup(
                                        blockPanelLayout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(BlockButton)
                                            .addComponent(WhoIBlockButton))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        blockPanelLayout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(UnblockButton)
                                            .addComponent(WhoBlocksMeButton)))
                            .addGroup(
                                blockPanelLayout
                                    .createSequentialGroup()
                                    .addGap(13, 13, 13)
                                    .addComponent(
                                        UserToChangeBlock,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    networkPanel.setBackground(new java.awt.Color(52, 73, 94));
    networkPanel.setBorder(
        javax.swing.BorderFactory.createTitledBorder(
            new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED),
            "Network",
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION,
            null,
            new java.awt.Color(240, 240, 240)));

    PortInput.setBackground(new java.awt.Color(127, 140, 141));
    SetPortButton.setText("Set Port");
    HostInput.setBackground(new java.awt.Color(127, 140, 141));
    SetHostButton.setText("Set Host");
    GetHost.setText("Get Host");
    GetPort.setText("Get Port");

    javax.swing.GroupLayout networkPanelLayout = new javax.swing.GroupLayout(networkPanel);
    networkPanel.setLayout(networkPanelLayout);
    networkPanelLayout.setHorizontalGroup(
        networkPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                networkPanelLayout
                    .createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(
                        networkPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(PortInput)
                            .addComponent(
                                HostInput,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                151,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(
                        networkPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(
                                networkPanelLayout
                                    .createSequentialGroup()
                                    .addGap(6, 6, 6)
                                    .addComponent(
                                        SetHostButton,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE))
                            .addGroup(
                                networkPanelLayout
                                    .createSequentialGroup()
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        SetPortButton,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        79,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(
                        networkPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(
                                GetPort,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(GetHost))
                    .addGap(25, 25, 25)));
    networkPanelLayout.setVerticalGroup(
        networkPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                networkPanelLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        networkPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                PortInput,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(SetPortButton)
                            .addComponent(GetPort))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        networkPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                HostInput,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(SetHostButton)
                            .addComponent(GetHost))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    javax.swing.GroupLayout SettingsWindowLayout = new javax.swing.GroupLayout(SettingsWindow);
    SettingsWindow.setLayout(SettingsWindowLayout);
    SettingsWindowLayout.setHorizontalGroup(
        SettingsWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                SettingsWindowLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        SettingsWindowLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                networkPanel,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                settingsChatPanel,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                blockPanel,
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addContainerGap()));
    SettingsWindowLayout.setVerticalGroup(
        SettingsWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                SettingsWindowLayout.createSequentialGroup()
                    .addGap(20, 20, 20)
                    .addComponent(
                        networkPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(33, 33, 33)
                    .addComponent(
                        blockPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(31, 31, 31)
                    .addComponent(
                        settingsChatPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(34, Short.MAX_VALUE)));

    MainWindowTabs.addTab("Settings", SettingsWindow);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(chatFrame.getContentPane());
    chatFrame.getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(
                        MainWindowTabs,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        413,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                MainWindowTabs,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                439,
                javax.swing.GroupLayout.PREFERRED_SIZE));

    // ##################### Listeners #####################

    // display scrollbar vertical update
    ChatDisplayScroll.getVerticalScrollBar()
        .addAdjustmentListener(
            new AdjustmentListener() {
              public void adjustmentValueChanged(AdjustmentEvent event) {
                event.getAdjustable().setValue(event.getAdjustable().getMaximum());
              }
            });

    MessageInput.addKeyListener(
        new KeyListener() {
          @Override
          public void keyPressed(KeyEvent arg0) {
            int keyCode = arg0.getKeyCode();
            if (keyCode == 10) { // enter key
              String message = MessageInput.getText();
              if (message != null && message.length() > 0) {
                client.handleMessageFromClientUI(message);
                MessageInput.setText("");
                arg0.consume();
              }
            }
          }

          @Override
          public void keyTyped(KeyEvent arg0) {}

          @Override
          public void keyReleased(KeyEvent arg0) {}
        });

    SetChannelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = SetChannelButton.getActionCommand();
            if (command == "Set Channel") {
              // get new channel
              String channel = ChannelToSetTo.getText();
              if (channel.length() > 0) {
                client.handleMessageFromClientUI("#setchannel " + channel);
                ChannelToSetTo.setText("");
                MainWindowTabs.setSelectedIndex(0);
              }
            }
          }
        });

    SetPortButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = SetPortButton.getActionCommand();
            if (command == "Set Port") {
              // get new port
              String port = PortInput.getText();
              if (port.length() > 0) {
                client.connectionClosed();
                client.handleMessageFromClientUI("#setport " + port);
                MainWindowTabs.setSelectedIndex(0);
                PortInput.setText("");
              }
            }
          }
        });

    GetPort.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = GetPort.getActionCommand();
            if (command == "Get Port") {
              client.handleMessageFromClientUI("#getport");
              MainWindowTabs.setSelectedIndex(0);
            }
          }
        });

    SetHostButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = SetHostButton.getActionCommand();
            if (command == "Set Host") {
              // get new host
              String host = HostInput.getText();
              if (host.length() > 0) {
                client.connectionClosed();
                client.handleMessageFromClientUI("#sethost " + host);
                MainWindowTabs.setSelectedIndex(0);
                HostInput.setText("");
              }
            }
          }
        });

    GetHost.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = GetHost.getActionCommand();
            if (command == "Get Host") {
              client.handleMessageFromClientUI("#gethost");
              MainWindowTabs.setSelectedIndex(0);
            }
          }
        });

    WhoIBlockButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = WhoIBlockButton.getActionCommand();
            if (command == "My Blocks") {
              client.handleMessageFromClientUI("#whoiblock");
              MainWindowTabs.setSelectedIndex(0);
            }
          }
        });

    WhoBlocksMeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = WhoBlocksMeButton.getActionCommand();
            if (command == "Blocks Me") {
              client.handleMessageFromClientUI("#whoblocksme");
              MainWindowTabs.setSelectedIndex(0);
            }
          }
        });

    BlockButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = BlockButton.getActionCommand();
            if (command == "Block") {
              // get blockee
              String blockee = UserToChangeBlock.getText();
              if (blockee.length() > 0) {
                client.handleMessageFromClientUI("#block " + blockee);
                UserToChangeBlock.setText("");
                MainWindowTabs.setSelectedIndex(0);
              }
            }
          }
        });

    UnblockButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = UnblockButton.getActionCommand();
            if (command == "Unblock") {
              // get unblockee
              String unblockee = UserToChangeBlock.getText();
              client.handleMessageFromClientUI("#unblock " + unblockee);
              UserToChangeBlock.setText("");
              MainWindowTabs.setSelectedIndex(0);
            }
          }
        });

    ForwardButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = ForwardButton.getActionCommand();
            if (command == "Forward") {
              // get new monitor
              String monitor = ForwardTo.getText();
              if (monitor.length() > 0) {
                client.handleMessageFromClientUI("#forward " + monitor);
                ForwardTo.setText("");
                MainWindowTabs.setSelectedIndex(0);
              }
            } else if (command == "Stop Forwarding") {
              client.handleMessageFromClientUI("#endforward");
            }
          }
        });

    Availability.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (Availability.isSelected()) {
              client.handleMessageFromClientUI("#notavailable");
              Availability.setText("Unavailable");
              Availability.setBackground(Color.decode("#E74C3C"));
              ForwardButton.setEnabled(false);
              MessageInput.setEnabled(false);
              DrawPadButton.setEnabled(false);
              PrivateMsg.setEnabled(false);
              Send.setEnabled(false);
            } else {
              client.handleMessageFromClientUI("#available");
              Availability.setText("Available");
              Availability.setBackground(Color.decode("#2ECC71"));
              ForwardButton.setEnabled(true);
              MessageInput.setEnabled(true);
              DrawPadButton.setEnabled(true);
              PrivateMsg.setEnabled(true);
              Send.setEnabled(true);
            }
          }
        });

    Send.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = Send.getActionCommand();
            if (command == "Send") {
              String message = MessageInput.getText();
              if (message != null && message.length() > 0) {
                client.handleMessageFromClientUI(message);
                MessageInput.setText("");
              }
            }
          }
        });

    DrawPadButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = DrawPadButton.getActionCommand();
            if (command == "Draw Pad") {
              drawPad = new ChatDrawPad();
              new OpenDrawPad(drawPad, self);
            }
          }
        });

    PrivateMsg.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = PrivateMsg.getActionCommand();
            if (command == "Private Message") {
              PrivateMessageDialog.setVisible(true);
            }
          }
        });

    SendPrivate.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String command = SendPrivate.getActionCommand();
            if (command == "Send") {
              String recipId = PvtUserId.getText();
              String msg = PrivateInput.getText();
              if (recipId.length() > 0 && msg.length() > 0)
                client.handleMessageFromClientUI("#private " + recipId + " " + msg);
              PvtUserId.setText("");
              PrivateInput.setText("");
              PrivateMessageDialog.setVisible(false);
            }
          }
        });

    // Display the window.
    chatFrame.pack();
    chatFrame.setVisible(true);
  }
  /** Create the panel. */
  public ArtistInfoPanel(final ArtistNode a) {
    super();
    NumberFormat nf1 = NumberFormat.getInstance();

    // Own settings
    setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
    setBackground(Color.DARK_GRAY);
    setLayout(new BorderLayout(0, 0));
    Utils.fixSize(this, size);

    // COMPONENTS

    // listener
    MouseListener ML_CLOSE =
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            GroovesharkConnector.getInstance().stop();
            NavigationPanel.getInstance().hideArtistInfoBox();
          }
        };

    MouseListener ML_CONFIRM =
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            GroovesharkConnector.getInstance().stop();
            GUI.getInstance().search(a);
            NavigationPanel.getInstance().hideArtistInfoBox();
          }
        };

    // Name panel
    // =========================================================================================
    JPanel namePanel = new JPanel();
    namePanel.setBackground(Color.DARK_GRAY);

    // Name panel / Scrobble label

    this.add(namePanel, BorderLayout.NORTH);
    namePanel.setLayout(new GridLayout(0, 2, 0, 0));

    JPanel upperleftPanel = new JPanel();
    upperleftPanel.setBackground(Color.DARK_GRAY);
    namePanel.add(upperleftPanel);
    upperleftPanel.setLayout(new BorderLayout(0, 0));

    // Name panel / Name label

    JLabel nameTxt = new JLabel(a.getName());
    upperleftPanel.add(nameTxt, BorderLayout.NORTH);
    nameTxt.setForeground(Color.WHITE);
    nameTxt.setHorizontalAlignment(SwingConstants.LEFT);
    nameTxt.setFont(new Font("Tahoma", Font.BOLD, 16));
    JLabel playTxt =
        new JLabel(
            "("
                + nf1.format(a.getScrobbles())
                + " scrobbled tracks, "
                + nf1.format(a.getListener())
                + " listeners)");
    upperleftPanel.add(playTxt, BorderLayout.SOUTH);
    playTxt.setForeground(Color.WHITE);
    playTxt.setHorizontalAlignment(SwingConstants.LEFT);
    playTxt.setFont(new Font("Tahoma", Font.ITALIC, 13));

    JPanel closePanel = new JPanel();
    closePanel.setBackground(Color.DARK_GRAY);
    namePanel.add(closePanel);
    closePanel.setLayout(null);

    CloseButton btnX = new CloseButton("x");
    btnX.resizeButton(20, 20);
    btnX.setBounds(429, 0, 20, 20);
    btnX.addMouseListener(ML_CLOSE);
    closePanel.add(btnX);
    // =========================================================================================

    // content panel
    // =========================================================================================
    JTabbedPane contentPanel = new JTabbedPane(JTabbedPane.LEFT);
    contentPanel.setLayout(new BorderLayout(0, 0));
    contentPanel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    contentPanel.setOpaque(true);
    contentPanel.setBackground(Color.DARK_GRAY);
    contentPanel.setForeground(Color.BLACK);

    // content panel / biography panel

    JScrollPane bioPanel = new JScrollPane();
    bioPanel.setLayout(new ScrollPaneLayout());

    // content panel / biography panel / biography TextArea

    JTextArea bioArea = new SanTextbox(Utils.deleteHTMLfromText(a.getWikiFull()));
    bioArea.setBorder(new LineBorder(new Color(0, 0, 0)));
    bioArea.setBounds(new Rectangle(500, 300));
    bioArea.setBackground(Color.DARK_GRAY);
    bioArea.setForeground(Color.WHITE);
    bioArea.setEditable(false);
    bioArea.setWrapStyleWord(true);
    bioArea.setLineWrap(true);
    bioArea.setSelectionColor(bioArea.getBackground());

    Font f = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
    GridBagConstraints gbc_bioArea = new GridBagConstraints();
    gbc_bioArea.insets = new Insets(0, 0, 5, 0);
    gbc_bioArea.fill = GridBagConstraints.BOTH;
    gbc_bioArea.gridx = 0;
    gbc_bioArea.gridy = 0;
    FontMetrics fm = bioArea.getFontMetrics(f);
    bioArea.setSize(width, fm.getHeight() * bioArea.getLineCount());

    bioPanel.getViewport().setView(bioArea);
    VTextIcon contentIcon = new VTextIcon(contentPanel, "biography", VTextIcon.ROTATE_LEFT);

    // content panel / popular content panel

    JPanel popularPanel = new JPanel();
    popularPanel.setLayout(new GridLayout(1, 0));

    // content panel / popular content panel / container panel

    JPanel container = new JPanel();
    container.setLayout(new BorderLayout());

    // content panel / popular content panel / tracks panel
    JPanel tracksPanel = new JPanel();
    tracksPanel.setLayout(new GridLayout(Settings.TRACKFETCH, 0));
    tracksPanel.setBorder(
        new TitledBorder(
            new BevelBorder(BevelBorder.LOWERED, null, null, null, null),
            "top tracks:",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    ContentTrackField.resetList();

    Iterator<Track> t = a.getTopTracks().iterator();

    // content panel / popular content panel / tracks panel / tracks
    for (int z = 0; t.hasNext(); z++) {
      Track track = t.next();
      JLabel feld = new ContentTrackField(track.getListeners());
      Dimension feldd = new Dimension(500, (20 - 3 * z));
      feld.setSize(feldd);
      Font fontor = new Font("Tahoma", z < 2 ? Font.BOLD : Font.PLAIN, 19 - z);
      feld.setFont(fontor);
      feld.setText(track.getName() + " (" + nf1.format(track.getListeners()) + " listeners)");
      tracksPanel.add(feld);
    }
    ContentTrackField.recalc();

    container.add(tracksPanel, BorderLayout.CENTER);

    // content panel / popular content panel / albums panel
    JPanel albumsPanel = new JPanel();
    albumsPanel.setSize(500, 100);
    albumsPanel.setLayout(new GridLayout(Settings.ALBUMFETCH, 0));
    albumsPanel.setBorder(
        new TitledBorder(
            new BevelBorder(BevelBorder.LOWERED, null, null, null, null),
            "top albums:",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    ContentAlbumField.resetList();

    Iterator<Album> albI = a.getTopAlbums().iterator();

    // content panel / popular content panel / albums panel / albums
    for (int z = 0; albI.hasNext(); z++) {
      Album album = albI.next();
      JLabel feld = new ContentAlbumField(album.getListeners());
      Dimension feldd = new Dimension(500, (20 - 3 * z));
      feld.setSize(feldd);
      Font fontor = new Font("Tahoma", z < 2 ? Font.BOLD : Font.PLAIN, 19 - 2 * z);
      feld.setFont(fontor);
      feld.setText(album.getName());
      albumsPanel.add(feld);
    }
    ContentAlbumField.recalc();

    container.add(albumsPanel, BorderLayout.SOUTH);

    popularPanel.add(container);
    VTextIcon popularIcon = new VTextIcon(contentPanel, "popular content", VTextIcon.ROTATE_LEFT);

    // content panel / blogpost panel

    JScrollPane postPanel = new JScrollPane();
    postPanel.setLayout(new ScrollPaneLayout());
    postPanel.getVerticalScrollBar().setBlockIncrement(1);
    postPanel.setSize(500, 300);
    VTextIcon blogIcon = new VTextIcon(contentPanel, "blog posts", VTextIcon.ROTATE_LEFT);

    // content panel / blogpost panel / posts list

    JList<BlogPost> list = new JList<BlogPost>();
    DefaultListModel<BlogPost> model = new DefaultListModel<BlogPost>();
    BlogPost[] posts = Utils.sortBlogPostArray(a.getRelatedHypemPosts(), Settings.Sort.BYLIKES);
    if (posts != null) {
      for (BlogPost b : posts) {
        model.addElement(b);
      }
      list.setCellRenderer(new BlogPostListCellRenderer());
    } else {
      list.setSelectionBackground(Color.WHITE);
      list.setBorder(null);
    }
    list.setFixedCellHeight(150);
    list.setModel(model);

    postPanel.getViewport().setView(list);

    // composing the tab order for the content panel
    // 1. popular content, 2. biography, 3. blog posts
    contentPanel.addTab(TABLENGTH, popularIcon, popularPanel);
    contentPanel.addTab(TABLENGTH, contentIcon, bioPanel);
    contentPanel.addTab(TABLENGTH, blogIcon, postPanel);

    // adding the content panel to the main panel
    this.add(contentPanel, BorderLayout.CENTER);
    // =========================================================================================

    // west panel
    // =========================================================================================
    JPanel panel = new JPanel();
    panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panel.setBackground(Color.DARK_GRAY);
    panel.setLayout(new BorderLayout(0, 0));

    // west panel / image panel

    JPanel imagePanel = new ImagePanel(a.getLargeImage());
    imagePanel.setBackground(Color.DARK_GRAY);

    panel.add(imagePanel, BorderLayout.CENTER);

    // west panel / tags panel
    JPanel tagsPanel = new JPanel();
    tagsPanel.setLayout(new BorderLayout(0, 0));
    tagsPanel.setBorder(
        new TitledBorder(
            new BevelBorder(BevelBorder.LOWERED, null, null, null, null),
            "tags:",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    tagsPanel.setForeground(Color.WHITE);
    tagsPanel.setBackground(Color.DARK_GRAY);

    // west panel / image panel / textfield

    JTextArea tagField = new SanTextbox();
    tagField.setWrapStyleWord(true);
    tagField.setEnabled(false);
    tagField.setEditable(false);
    tagField.setLineWrap(true);
    tagField.setBorder(null);
    tagField.setBackground(null);
    tagField.setForeground(Color.WHITE);

    StringBuilder sb = new StringBuilder();
    for (Iterator<String> i = a.getTags().iterator(); i.hasNext(); ) {
      sb.append(i.next());
      if (i.hasNext()) sb.append(", ");
    }
    tagField.setText(sb.toString());
    tagField.setColumns(10);

    tagsPanel.add(tagField);

    panel.add(tagsPanel, BorderLayout.SOUTH);

    this.add(panel, BorderLayout.WEST);

    // =========================================================================================

    // south panel
    // =========================================================================================
    JPanel musicPanel = new JPanel();
    musicPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    // get tracks for element creation
    ArrayList<Track> tracks = (ArrayList<Track>) a.getTopTracks();
    musicPanel.setLayout(new GridLayout(0, 2));
    musicPanel.setBackground(Color.DARK_GRAY);

    // south panel / track play elements (according to artist node information)

    JPanel musicElementsPanel = new JPanel();
    musicElementsPanel.setSize(500, 300);
    musicElementsPanel.setBackground(Color.DARK_GRAY);
    musicPanel.add(musicElementsPanel);
    musicElementsPanel.setLayout(new GridLayout(0, 1));

    if (tracks != null && tracks.size() > 0) {
      for (int i = 0; i < 5; i++) {
        TrackPlayElement element = new TrackPlayElement(a.getName(), tracks.get(i).getName());
        if (element != null) {
          element.setForeground(Color.WHITE);
          musicElementsPanel.add(element);
        }
      }
    }

    JPanel buttonsPanel = new JPanel();
    buttonsPanel.setLayout(null);

    JButton confirmButton = new JButton("<html>Save this artist & do another search</html>");
    confirmButton.setBounds(337, 9, 100, 100);
    confirmButton.addMouseListener(ML_CONFIRM);
    buttonsPanel.add(confirmButton);

    JButton abortButton = new JButton("Go back");
    abortButton.setBounds(337, 120, 99, 23);
    abortButton.addMouseListener(ML_CLOSE);
    buttonsPanel.add(abortButton);

    buttonsPanel.setBackground(Color.DARK_GRAY);

    musicPanel.add(buttonsPanel);

    this.add(musicPanel, BorderLayout.SOUTH);
    Dimension d = new Dimension(500, 150);
    Utils.fixSize(musicPanel, d);

    // =========================================================================================
  }
Beispiel #28
0
 public void hiliteControl(JPanel mycomp, String msg) {
   l_error.setText(TDSLanguageUtils.getMessage(msg));
   mycomp.requestFocus();
   mycomp.setForeground(Color.RED);
   l_error.setForeground(Color.RED);
 }
Beispiel #29
0
  /*
   * call in constructor only
   */
  private JPanel createTable() {

    JPanel outerPanel = new JPanel();
    outerPanel.setLayout(new BorderLayout());

    outerPanel.setOpaque(true);
    outerPanel.setBackground(Color.black);

    JLabel title = new JLabel("Geheugen");
    title.setOpaque(true);
    title.setForeground(Color.white);
    title.setBackground(Color.blue);
    title.setHorizontalAlignment(JLabel.CENTER);

    outerPanel.add(title, BorderLayout.NORTH);

    JPanel panel = new JPanel();
    GridLayout layout = new GridLayout(_realSize + 1, 3);
    layout.setHgap(3);
    layout.setVgap(3);
    panel.setLayout(layout);
    panel.setForeground(Color.white);
    panel.setBackground(Color.black);

    JLabel labelLabel = new JLabel("Label");
    JLabel addressLabel = new JLabel("Adres");
    JLabel contentLabel = new JLabel("Inhoud");
    labelLabel.setOpaque(true);
    labelLabel.setForeground(Color.white);
    labelLabel.setBackground(Color.blue);
    labelLabel.setHorizontalAlignment(JLabel.CENTER);
    addressLabel.setOpaque(true);
    addressLabel.setForeground(Color.white);
    addressLabel.setBackground(Color.blue);
    addressLabel.setHorizontalAlignment(JLabel.CENTER);
    contentLabel.setOpaque(true);
    contentLabel.setForeground(Color.white);
    contentLabel.setBackground(Color.blue);
    contentLabel.setHorizontalAlignment(JLabel.CENTER);
    panel.add(labelLabel);
    panel.add(addressLabel);
    panel.add(contentLabel);

    _labels = new JLabel[_realSize];
    _addresses = new JLabel[_realSize];
    _values = new JLabel[_realSize];

    for (int i = 0; i < _realSize; i++) {
      _labels[i] = new JLabel();
      _labels[i].setForeground(Color.white);
      _labels[i].setHorizontalAlignment(JLabel.CENTER);
      panel.add(_labels[i]);
      _addresses[i] = new JLabel("");
      // _addresses[i].setOpaque(true);
      // _addresses[i].setBackground(Color.gray);
      _addresses[i].setForeground(Color.white);
      _addresses[i].setHorizontalAlignment(JLabel.CENTER);
      panel.add(_addresses[i]);
      _values[i] = new JLabel("");
      _values[i].setOpaque(true);
      _values[i].setBackground(Color.gray);
      _values[i].setForeground(Color.white);
      _values[i].setHorizontalAlignment(JLabel.CENTER);
      panel.add(_values[i]);
    }

    outerPanel.add(panel, BorderLayout.CENTER);

    return outerPanel;
  }
  public void createDataEditPanelCourse(String CourseNo, String CourseName, String CourseCredit) {

    this.CourseNo = CourseNo;
    this.CourseName = CourseName;
    this.CourseCredit = CourseCredit;

    Credit = Float.parseFloat(CourseCredit);

    if (Credit == 0.75) CreditIndex = 0;
    else if (Credit == 1.50) CreditIndex = 1;
    else if (Credit == 3.00) CreditIndex = 2;
    else CreditIndex = 3;

    DEPC = new JDialog();
    DEPC.setTitle("Course Edit Dialog");

    Panel =
        new JPanel() {
          protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.drawImage(
                new ImageIcon(getClass().getResource("/Icons/8.jpg")).getImage(),
                0,
                0,
                600,
                230,
                null);
            ButtonBorder.paintBorder(this, g, 172, 136, 130, 25);
          }
        };
    Panel.setForeground(Color.WHITE);
    Panel.setLayout(null);

    CourseNoLabel1 = new JLabel("Course No.          : ");
    CourseNoLabel1.setForeground(Color.WHITE);
    CourseNoLabel1.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 12));
    CourseNoLabel1.setBounds(77, 29, 139, 27);
    Panel.add(CourseNoLabel1);

    CourseNoLabel2 = new JLabel(this.CourseNo);
    CourseNoLabel2.setForeground(Color.WHITE);
    CourseNoLabel2.setFont(new Font("Rockwell Extra Bold", Font.BOLD, 12));
    CourseNoLabel2.setBounds(213, 29, 200, 27);
    Panel.add(CourseNoLabel2);

    CourseNameLabel = new JLabel("Course Title       :");
    CourseNameLabel.setForeground(Color.WHITE);
    CourseNameLabel.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 12));
    CourseNameLabel.setBounds(77, 56, 139, 26);
    Panel.add(CourseNameLabel);

    CourseNameField = new JTextField(this.CourseName);
    CourseNameField.setForeground(Color.WHITE);
    CourseNameField.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 10));
    CourseNameField.setBounds(213, 60, 200, 20);
    CourseNameField.setOpaque(false);
    CourseNameField.setHorizontalAlignment(SwingConstants.CENTER);
    Panel.add(CourseNameField);

    CourseCreditLabel = new JLabel("Course Credit   :");
    CourseCreditLabel.setForeground(Color.WHITE);
    CourseCreditLabel.setBounds(77, 87, 139, 26);
    CourseCreditLabel.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 12));
    Panel.add(CourseCreditLabel);

    CourseCreditBox = new JComboBox<String>();
    CourseCreditBox.setBackground(Color.GRAY);
    CourseCreditBox.setForeground(new Color(28, 0, 0));
    CourseCreditBox.setBounds(213, 91, 103, 20);
    CourseCreditBox.setBorder(ButtonBorder);
    CourseCreditBox.addItem("0.75");
    CourseCreditBox.addItem("1.50");
    CourseCreditBox.addItem("3.00");
    CourseCreditBox.addItem("4.00");
    CourseCreditBox.setMaximumRowCount(3);
    CourseCreditBox.setSelectedIndex(CreditIndex);
    Panel.add(CourseCreditBox);

    UpdateButton = new JButton("Update");
    UpdateButton.setForeground(Color.WHITE);
    UpdateButton.setFont(new Font("Rockwell Extra Bold", Font.BOLD, 10));
    UpdateButton.setBounds(173, 137, 128, 23);
    UpdateButton.setContentAreaFilled(false);
    UpdateButton.addActionListener(this);
    Panel.add(UpdateButton);

    DEPC.getContentPane().add(Panel);
    DEPC.setSize(500, 230);
    DEPC.setLocation(500, 200);
    DEPC.setResizable(false);
    DEPC.setVisible(true);
    DEPC.setModal(true);
  }