コード例 #1
0
 public void showInstructions() {
   if (instructions != null) {
     instructionsLabel.setText(instructions);
     instructionsLabel.setVisible(true);
   } else {
     instructionsLabel.setVisible(false);
   }
 }
コード例 #2
0
ファイル: FrameModules.java プロジェクト: RubelAhmed57/KEEL
 /**
  * Exit from exit button
  *
  * @param e Event
  */
 public void accionExit_mouseExited(MouseEvent e) {
   barraExit.setIcon(
       new ImageIcon(
           this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/exit.png")));
   labelSalir.setVisible(false);
   this.setCursor(Cursor.DEFAULT_CURSOR);
 }
コード例 #3
0
ファイル: FrameModules.java プロジェクト: RubelAhmed57/KEEL
 /**
  * Enter in MIL button
  *
  * @param e Event
  */
 public void mil_mouseEntered(MouseEvent e) {
   mil.setIcon(
       new ImageIcon(
           this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/mil2.png")));
   labelMil.setVisible(true);
   this.setCursor(Cursor.HAND_CURSOR);
 }
コード例 #4
0
ファイル: FrameModules.java プロジェクト: RubelAhmed57/KEEL
 /**
  * Exit from MIL button
  *
  * @param e Event
  */
 public void mil_mouseExited(MouseEvent e) {
   mil.setIcon(
       new ImageIcon(
           this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/mil.png")));
   labelMil.setVisible(false);
   this.setCursor(Cursor.DEFAULT_CURSOR);
 }
コード例 #5
0
ファイル: FrameModules.java プロジェクト: RubelAhmed57/KEEL
 /**
  * Enter in statistical button
  *
  * @param e Event
  */
 public void nonParametric_mouseEntered(MouseEvent e) {
   nonParametric.setIcon(
       new ImageIcon(
           this.getClass()
               .getResource("/keel/GraphInterKeel/resources/imag/menu/nonParametric2.png")));
   labelNonParametric.setVisible(true);
   this.setCursor(Cursor.HAND_CURSOR);
 }
コード例 #6
0
ファイル: Mart.java プロジェクト: Camtendo/jokemon
 // Updates the Buttons and what is visible and what isn't
 private void updateGui() {
   updateDisplay();
   if (!itemSelected) {
     for (int i = 0; i < pockets.length; i++) {
       pockets[i].setVisible(true);
       pages[i].setVisible(true);
     }
     for (JButton aDisplay : display) {
       aDisplay.setVisible(true);
     }
     information.setVisible(true);
     closeButton.setVisible(true);
     moneyDisplay.setVisible(true);
     buySellButton.setVisible(true);
     buyButton.setVisible(false);
     amountField.setVisible(false);
     amountDisplay.setVisible(false);
     totalAmount.setVisible(false);
     buyButton.setVisible(false);
     sellButton.setVisible(false);
     moneyDisplay.setText("Money: $" + Inventory.money);
     updatePageButtons();
   } else {
     if (state == State.BUY) {
       buyButton.setVisible(true);
       sellButton.setVisible(false);
     } else {
       buyButton.setVisible(false);
       sellButton.setVisible(true);
     }
     amountDisplay.setVisible(true);
     totalAmount.setVisible(true);
     buySellButton.setVisible(false);
     for (int i = 1; i < display.length; i++) {
       display[i].setVisible(false);
     }
     amountField.setVisible(true);
     for (int i = 0; i < pockets.length; i++) {
       pockets[i].setVisible(false);
       pages[i].setVisible(false);
     }
     moneyDisplay.setText("Money: $" + Inventory.money);
   }
 }
コード例 #7
0
ファイル: LoginBox.java プロジェクト: timburrow/ovj3
 public void setVisible(boolean bShow, String title) {
   if (bShow) {
     String strDir = "";
     String strFreq = "";
     String strTraynum = "";
     m_strHelpFile = getHelpFile(title);
     String strSampleName = getSampleName(title);
     String frameBounds = getFrameBounds(title);
     StringTokenizer tok = new QuotedStringTokenizer(title);
     if (tok.hasMoreTokens()) strDir = tok.nextToken();
     if (tok.hasMoreTokens()) strFreq = tok.nextToken();
     if (tok.hasMoreTokens()) strTraynum = tok.nextToken();
     else {
       try {
         Integer.parseInt(strDir);
         // if strdir is number, then strdir is empty, and the
         // strfreq is the number
         strTraynum = strFreq;
         strFreq = strDir;
         strDir = "";
       } catch (Exception e) {
       }
     }
     try {
       setTitle(gettitle(strFreq));
       m_lblSampleName.setText("3");
       boolean bVast = isVast(strTraynum);
       CardLayout layout = (CardLayout) m_pnlSampleName.getLayout();
       if (!bVast) {
         if (strSampleName == null) {
           strSampleName = getSampleName(strDir, strTraynum);
         }
         m_lblSampleName.setText(strSampleName);
         layout.show(m_pnlSampleName, OTHER);
       } else {
         m_strDir = strDir;
         setTrays();
         layout.show(m_pnlSampleName, VAST);
         m_trayTimer.start();
       }
       boolean bSample = bVast || !strSampleName.trim().equals("");
       m_pnlSampleName.setVisible(bSample);
       m_lblLogin.setForeground(getBackground());
       m_lblLogin.setVisible(false);
       m_passwordField.setText("");
       m_passwordField.setCaretPosition(0);
     } catch (Exception e) {
       Messages.writeStackTrace(e);
     }
     setBounds(frameBounds);
     ExpPanel exp = Util.getActiveView();
     if (exp != null) exp.waitLogin(true);
   }
   writePersistence();
   setVisible(bShow);
 }
コード例 #8
0
  public void refresh() {
    Message message = new Message();
    try {
      message = this.trainingTeaBLService.showFrameStrategy();

    } catch (RemoteException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    if (message.getMesType().equals(MessageType.traTea_showStrategy_fail)) {
      // JOptionPane.showMessageDialog(this, "整体框架策略尚未发布!");
      jl1.setVisible(true);
      jb2.setEnabled(false);
      if (jsp1 != null) {
        jsp1.setVisible(false);
      }
    } else if (message.getMesType().equals(MessageType.traTea_showStrategy_success)) {
      jl1.setVisible(false);
      ArrayList<Dean> dean = message.getDeans();
      ArrayList<String> attriOfDean = message.getAttriOfDean();
      tm1 = new StrategyTableModel(dean, attriOfDean);
      if (jsp1 != null) {
        jt1.setModel(tm1);
        jsp1.setVisible(true);
      } else {
        jt1 = new JTable();
        jt1.setModel(tm1);

        jsp1 = new JScrollPane(jt1);
        strategy.add(jsp1);
      }

      if (dean.size() >= 15) {
        jb1.setEnabled(false);
      }

      jb2.setEnabled(true);

    } else {
      JOptionPane.showMessageDialog(this, "你的网络貌似有点问题!");
    }
  }
コード例 #9
0
ファイル: MemoryGameB.java プロジェクト: sandy880/MemoryGame
  void isVisibl() {
    int cnt = 0;
    boolean vis;

    for (int j = 0; j < 20; j++) {
      vis = butI[j].isVisible();
      if (!vis) cnt++;
    }

    if (cnt == 20) {
      score();
      DigitalClock.flag = false;
      lblCongrt.setVisible(true);
      lblCongrt.setText("Congratulations you Scored : " + score + " marks");
      lblContestant.setVisible(true);
      lblContestant.setText("Contestant Name : " + name);
      butnPlayAgn.setVisible(true);
      butnQuit.setVisible(true);
    }
  }
コード例 #10
0
  public void showFrame(final Editor editor, boolean activateErrorPanel, final boolean loading) {
    this.editor = editor;

    setLayout(editor, activateErrorPanel, loading);
    contributionListPanel.setVisible(!loading);
    loaderLabel.setVisible(loading);
    errorPanel.setVisible(activateErrorPanel);

    validate();
    repaint();
  }
コード例 #11
0
  /**
   * Updates progress bar progress line every time a progress event has been received.
   *
   * @param event the <tt>FileTransferProgressEvent</tt> that notified us
   */
  public void progressChanged(FileTransferProgressEvent event) {
    progressBar.setValue((int) event.getProgress());

    long transferredBytes = event.getFileTransfer().getTransferedBytes();
    long progressTimestamp = event.getTimestamp();

    ByteFormat format = new ByteFormat();
    String bytesString = format.format(transferredBytes);

    if ((progressTimestamp - lastSpeedTimestamp) >= SPEED_CALCULATE_DELAY) {
      lastProgressSpeed = Math.round(calculateProgressSpeed(transferredBytes));

      this.lastSpeedTimestamp = progressTimestamp;
      this.lastTransferredBytes = transferredBytes;
    }

    if ((progressTimestamp - lastEstimatedTimeTimestamp) >= SPEED_CALCULATE_DELAY
        && lastProgressSpeed > 0) {
      lastEstimatedTime =
          Math.round(
              calculateEstimatedTransferTime(
                  lastProgressSpeed, transferredFileSize - transferredBytes));

      lastEstimatedTimeTimestamp = progressTimestamp;
    }

    progressBar.setString(getProgressLabel(bytesString));

    if (lastProgressSpeed > 0) {
      progressSpeedLabel.setText(
          resources.getI18NString("service.gui.SPEED") + format.format(lastProgressSpeed) + "/sec");
      progressSpeedLabel.setVisible(true);
    }

    if (lastEstimatedTime > 0) {
      estimatedTimeLabel.setText(
          resources.getI18NString("service.gui.ESTIMATED_TIME")
              + GuiUtils.formatSeconds(lastEstimatedTime * 1000));
      estimatedTimeLabel.setVisible(true);
    }
  }
コード例 #12
0
 public void showWrongNumInstructions() {
   if (minRobots == maxRobots) {
     if (minRobots == 1) {
       instructionsLabel.setText("Please select exactly 1 robot.");
     } else {
       instructionsLabel.setText("Please select exactly " + minRobots + " robots.");
     }
   } else {
     instructionsLabel.setText(
         "Please select between " + minRobots + " and " + maxRobots + " robots.");
   }
   instructionsLabel.setVisible(true);
 }
コード例 #13
0
ファイル: DisplayComponent.java プロジェクト: nbearson/IDV
  /**
   * Create, if needed, and return the component label
   *
   * @return component label
   */
  protected JLabel doMakeDisplayLabel() {
    if (displayLabel == null) {
      displayLabel = GuiUtils.cLabel(getName());

      Font f = displayLabel.getFont();
      f = f.deriveFont(18.0f);
      displayLabel.setFont(f);
      if (!labelShown) {
        displayLabel.setVisible(false);
      }
    }
    return displayLabel;
  }
コード例 #14
0
  @Override
  protected JComponent createCenterPanel() {
    myTitle.setText(myText);
    myOptionsPanel.setBorder(
        IdeBorderFactory.createTitledBorder(
            CodeInsightBundle.message("reformat.directory.dialog.options")));
    myFiltersPanel.setBorder(
        IdeBorderFactory.createTitledBorder(
            CodeInsightBundle.message("reformat.directory.dialog.filters")));

    myMaskWarningLabel.setIcon(AllIcons.General.Warning);
    myMaskWarningLabel.setVisible(false);

    myIncludeSubdirsCb.setVisible(shouldShowIncludeSubdirsCb());

    initFileTypeFilter();
    initScopeFilter();

    restoreCbsStates();
    return myWholePanel;
  }
コード例 #15
0
ファイル: Gui.java プロジェクト: hygzhu/java-incremental-game
  // action listeners
  public void actionPerformed(ActionEvent e) {

    // doge click button gives doge
    if (e.getSource() == dogeClick) {

      cps = cps + 1;

      Sounds.run("wow");

      // increases size of button temporarily
      if (animation == 0) {
        dogeClick.setBounds(460, 110, 80, 80);
        dogeClick.setIcon(new ImageIcon("Images/dogeopen.jpg"));
        animation = 1;

      } else if (animation == 1) {
        dogeClick.setBounds(450, 100, 100, 100);
        dogeClick.setIcon(new ImageIcon("Images/doge.jpg"));
        animation = 0;
      }

      // adds doge accordingly and updates JLabel
      doge = doge + ((clickUpgrade) * clickMultiply) * multiplier;
      dogeCount.setText("Doge: " + doge);

      // randomize text
      flavourClick.setText(flavourText[(int) (Math.random() * 49)]);
      flavourClick.setBounds(
          (int) (Math.random() * (800)), (int) ((Math.random() * (401)) + 50), getWidth(), 50);
      flavourClick.setFont(
          new Font("Comic Sans MS", Font.BOLD, (int) ((Math.random() * (15)) + 15)));
      Color colour = Random.getRandomColour();
      flavourClick.setForeground(colour);
      flavourClick.setVisible(true);
    }
    // for loop for all buttons
    for (int i = 0; i < MAX_UPGRADES; i++) {

      // updates button stats and count
      if (e.getSource() == producers[i] && doge >= producerStats[i].getCost()) {

        doge = doge - producerStats[i].getCost();
        producers[i].setIcon(new ImageIcon("Images//bought.PNG"));
        producerStats[i].increaseCount();
        producerStats[i].increaseCost();
        producers[i].setToolTipText(
            "Your "
                + producerStats[i].getButtonName()
                + " gives "
                + producerStats[i].getDogeProduction() * producerStats[i].getCount()
                + " doge per second");
        dps = dps + producerStats[i].getDogeProduction();
        buyProducers[i].setText(
            "Buy "
                + producerStats[i].getButtonName()
                + " for "
                + producerStats[i].getCost()
                + " doge");
        buyDetails[i].setText(
            "You have: " + producerStats[i].getCount() + " " + producerStats[i].getButtonName());
      }
    }
    // updates click stats and count
    for (int i = 0; i < MAX_CLICK; i++) {
      if (e.getSource() == clickers[i] && doge >= clickerStats[i].getCost()) {

        doge = doge - clickerStats[i].getCost();
        clickerStats[i].increaseCount();
        clickUpgrade = clickUpgrade + clickerStats[i].getClickBonus();
        clickMultiply = clickMultiply * clickerStats[i].getClickMultiplier();
        dogeClick.setToolTipText(
            "Each click gives you " + (clickUpgrade) * clickMultiply + " doge. wow");

        clickers[i].setVisible(false);
        buyClickers[i].setVisible(false);
      }
    }

    // secret developer button in corner
    if (e.getSource() == devButton) {

      doge = doge * 2;

      // plays Sandstorm by Darude
      Sounds.run("sandstorm");
    }
    if (e.getSource() == options) {

      // opens options gui
      Options options = new Options();
    }
    // saves current progress into save file
    if (e.getSource() == save) {

      // opens JOtionPane
      Sounds.run("save");
      Save temp = new Save();
      String name = JOptionPane.showInputDialog("What is the name of your save file?");
      temp.createOutputFile("Save//" + name + ".txt");

      String producerCount = "";
      String clickCount = "";
      String achievementCount = "";

      // adds line of code for the amount of producers
      for (int i = 0; i < MAX_UPGRADES; i++) {

        producerCount = producerCount + producerStats[i].getCount() + "|";
      }
      // adds line of code for the amount of clickers
      for (int i = 0; i < MAX_CLICK; i++) {

        // if bought write true
        if (clickerStats[i].getCount() != 0) {
          clickCount = clickCount + "t|";
        } else {
          // if not bought write false
          clickCount = clickCount + "f|";
        }
      }

      // adds a line of code for achievements
      for (int i = 0; i < MAX_ACHIEVEMENTS; i++) {

        // if possess write true
        if (achievementStats[i].getCount() != 0) {
          achievementCount = achievementCount + "t|";
        } else {
          // if do not have write f
          achievementCount = achievementCount + "f|";
        }
      }

      // add all lines to file
      temp.addInfo("" + doge);
      temp.addInfo("" + producerCount);
      temp.addInfo("" + clickCount);
      temp.addInfo("" + achievementCount);
      temp.closeOutputFile();
    }
    // opens existing save file
    if (e.getSource() == open) {

      Save temp = new Save();
      String name = JOptionPane.showInputDialog("What is the name of your save file?");
      temp.openInputFile("Save//" + name + ".txt");
      try {

        // counters to open save file
        int add = 0;
        String data = "";
        int producerCount = 0;
        int clickCount = 0;
        int achievementCount = 0;

        // turn each line into char array
        doge = Long.parseLong(temp.getInfo());
        char producerSave[] = temp.getInfo().toCharArray();
        char clickSave[] = temp.getInfo().toCharArray();
        char achievementSave[] = temp.getInfo().toCharArray();

        // looks at producer line and adjusts values and resets Jlabel
        // text
        for (int i = 0; i < producerSave.length; i++) {

          if (producerSave[i] != '|') {

            data = data + Character.getNumericValue(producerSave[i]);

          } else {

            // updates data in producers
            add = Integer.parseInt(data);
            producerStats[producerCount].setCount(add);
            producerStats[producerCount].setCost(
                (int)
                    (producerStats[producerCount].getCost()
                        * (add * producerStats[producerCount].getCostIncrease())));
            buyProducers[producerCount].setText(
                "Buy "
                    + producerStats[producerCount].getButtonName()
                    + " for "
                    + producerStats[producerCount].getCost()
                    + " doge");
            buyDetails[producerCount].setText(
                "You have: "
                    + producerStats[producerCount].getCount()
                    + " "
                    + producerStats[producerCount].getButtonName());
            producers[producerCount].setToolTipText(
                "Your "
                    + producerStats[producerCount].getButtonName()
                    + " gives "
                    + producerStats[producerCount].getDogeProduction()
                        * producerStats[producerCount].getCount()
                    + " doge per second");
            dps =
                dps
                    + (producerStats[producerCount].getDogeProduction()
                        * producerStats[producerCount].getCount());

            data = "";
            producerCount++;
            add = 0;
          }
        }
        // reads clicker upgrades saves
        for (int i = 0; i < MAX_CLICK * 2; i++) {

          if (clickSave[i] == 't') {

            // updates data in clickers
            clickerStats[clickCount].setCount(1);
            clickUpgrade =
                (clickUpgrade + clickerStats[clickCount].getClickBonus())
                    * clickerStats[clickCount].getClickMultiplier();
            dogeClick.setToolTipText("Each click gives you " + clickUpgrade + " doge. wow");

            clickers[clickCount].setVisible(false);
            buyClickers[clickCount].setVisible(false);

            clickCount++;

          } else if (clickSave[i] == 'f') {
            clickCount++;
          }
        }
        // reads achievement lines
        for (int i = 0; i < MAX_ACHIEVEMENTS * 2; i++) {

          if (achievementSave[i] == 't') {

            // updates achievements
            achievementStats[achievementCount].setCount(1);
            achievements[achievementCount].setVisible(true);

            achievementCount++;

          } else if (achievementSave[i] == 'f') {
            achievementCount++;
          }
        }

        dogeCount.setText("Doge: " + doge);
      } catch (IOException e1) {
        // access invalid file
        e1.printStackTrace();
        System.out.println("Invalid file!");
      }

      // closes input file
      try {
        temp.closeInputFile();
      } catch (IOException e1) {
        // access invalid file
        e1.printStackTrace();
        System.out.println("Invalid file!");
      }
    }
  }
コード例 #16
0
 private void showWarningAndDisableOK() {
   myMaskWarningLabel.setVisible(true);
   setOKActionEnabled(false);
 }
コード例 #17
0
  private void makeAndSetTabComponents() {
    final String[] tabTitles = {"Libraries", "Modes", "Tools", "Examples", "Updates"};
    tabLabels = new JLabel[4];

    for (int i = 0; i < 4; i++) {
      final int temp = i;
      tabLabels[i] =
          new JLabel(tabTitles[i]) {
            @Override
            protected void paintComponent(Graphics g) {
              g.setClip(
                  Toolkit.createRoundRect(
                      0, 0, getWidth(), getHeight(), temp == 0 ? 6 : 0, temp == 3 ? 6 : 0, 0, 0));
              super.paintComponent(g);
            }
          };
      tabLabels[i].setForeground(Color.WHITE);
      tabLabels[i].setBackground(new Color(0x2d4251));
      tabLabels[i].setOpaque(true);
      tabLabels[i].setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
      tabLabels[i].setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT));
      tabLabels[i].setHorizontalAlignment(SwingConstants.CENTER);
      tabLabels[i].setFont(Toolkit.getSansFont(14, Font.BOLD));
      tabbedPane.setTabComponentAt(i, tabLabels[i]);
    }

    updateTabPanel =
        new JPanel() {
          @Override
          protected void paintComponent(Graphics g) {
            g.setClip(Toolkit.createRoundRect(0, 0, getWidth(), getHeight(), 6, 6, 0, 0));
            super.paintComponent(g);
          }
        };
    ;
    updateTabLabel = new JLabel("Updates");
    updateTabLabel.setFont(Toolkit.getSansFont(14, Font.BOLD));
    numberLabel.setVerticalTextPosition(SwingConstants.CENTER);
    numberLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    numberLabel.setFont(Toolkit.getSansFont(14, Font.BOLD));
    numberLabel.setForeground(Color.WHITE);
    updateTabPanel.setOpaque(true);
    updateTabPanel.setBackground(new Color(0x2d4251));
    updateTabLabel.setForeground(Color.WHITE);
    updateTabPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
    updateTabPanel.setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT));
    tabbedPane.setTabComponentAt(4, updateTabPanel);

    GroupLayout tabLayout = new GroupLayout(updateTabPanel);
    tabLayout.setAutoCreateGaps(true);
    updateTabPanel.setLayout(tabLayout);
    tabLayout.setHorizontalGroup(
        tabLayout
            .createSequentialGroup()
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
            .addComponent(updateTabLabel)
            .addComponent(numberLabel)
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED,
                GroupLayout.PREFERRED_SIZE,
                Short.MAX_VALUE));
    tabLayout.setVerticalGroup(
        tabLayout
            .createParallelGroup(GroupLayout.Alignment.CENTER)
            .addComponent(numberLabel)
            .addComponent(updateTabLabel));

    numberLabel.setVisible(false);
  }
コード例 #18
0
  public void addKey(final String key, boolean showExpand) {

    Color rowColor = Color.WHITE;
    if (keyKeyComponentMap.size() % 2 == 0) {
      rowColor = ViewUtil.getAlternateRowColor();
    }

    if (newRowsGoIntoMoreSection) {
      keysInMoreSection.add(key);
    }

    rowColor = Color.white;

    String layoutConstraints = "insets 3 3 3 3, filly";

    JPanel valuePanel = ViewUtil.getClearPanel();
    valuePanel.setLayout(new MigLayout(layoutConstraints));
    valuePanel.setBackground(rowColor);

    int i = 0;

    JPanel keyPanel = ViewUtil.getClearPanel();
    keyPanel.setLayout(new MigLayout(layoutConstraints + ", alignx right, hmin 30"));

    keyPanel.setBackground(rowColor);

    final JLabel keyLabel = getKeyLabel(key);

    // keyLabel.setBorder(ViewUtil.getMediumBorder());
    keyKeyComponentMap.put(key, keyLabel);

    if (showExpand) {

      keyLabel.setText("? " + key.toUpperCase());

      keyLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
      keyLabel.addMouseListener(
          new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent me) {
              toggleMoreVisibility();

              if (keyLabel.getText().startsWith("?")) {
                keyLabel.setText("? " + key.toUpperCase());
              } else {
                keyLabel.setText("? " + key.toUpperCase());
              }
            }
          });
    }

    keyPanel.add(keyLabel);

    keyLabel.setVisible(keysVisible);

    kvpPanel.add(keyPanel, incrementConstraintRow(i++));
    kvpPanel.add(valuePanel, incrementConstraintRow(i++));

    JPanel[] extraComponents = new JPanel[additionalColumns];
    for (int j = 0; j < additionalColumns; j++) {
      JPanel panel = ViewUtil.getClearPanel();
      panel.setBackground(rowColor);
      ViewUtil.applyHorizontalBoxLayout(panel);
      // panel.setBorder(border);
      // panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
      extraComponents[j] = panel; // ViewUtil.getClearPanel();
      kvpPanel.add(extraComponents[j], incrementConstraintRow(i++));
    }

    // add hidden panel
    keyDetailConstraints.gridy++;
    keyDetailConstraints.gridy++;

    JPanel detailPanel = ViewUtil.getClearPanel();
    detailPanel.setBackground(rowColor);
    // detailPanel.setBorder(ViewUtil.getTinyLineBorder());
    detailPanel.setVisible(false);
    keyDetailComponentMap.put(key, detailPanel);

    kvpPanel.add(detailPanel, keyDetailConstraints);

    // update all constraints to skip a line
    for (int k = 0; k < 2 + additionalColumns; k++) {
      incrementConstraintRow(k);
    }

    keyValueComponentMap.put(key, valuePanel);
    keyExtraComponentsMap.put(key, extraComponents);

    setMoreVisibility(showingMore);
  }
コード例 #19
0
ファイル: MemoryGameB.java プロジェクト: sandy880/MemoryGame
  void initComponents() {
    iconOrg = new ImageIcon("images\\but.jpg");

    int rnum = r.nextInt(3);

    switch (rnum) {
      case 0:
        icon[0] = new ImageIcon("images\\car1.jpg");
        icon[1] = new ImageIcon("images\\car2.jpg");
        icon[2] = new ImageIcon("images\\car3.jpg");
        icon[3] = new ImageIcon("images\\car4.jpg");
        icon[4] = new ImageIcon("images\\car5.jpg");
        icon[5] = new ImageIcon("images\\car6.jpg");
        icon[6] = new ImageIcon("images\\car7.jpg");
        icon[7] = new ImageIcon("images\\car8.jpg");
        icon[8] = new ImageIcon("images\\car9.jpg");
        icon[9] = new ImageIcon("images\\car10.jpg");
        break;
      case 1:
        icon[0] = new ImageIcon("images\\p1.jpg");
        icon[1] = new ImageIcon("images\\p2.jpg");
        icon[2] = new ImageIcon("images\\p3.jpg");
        icon[3] = new ImageIcon("images\\p4.jpg");
        icon[4] = new ImageIcon("images\\p5.jpg");
        icon[5] = new ImageIcon("images\\p6.jpg");
        icon[6] = new ImageIcon("images\\p7.jpg");
        icon[7] = new ImageIcon("images\\p8.jpg");
        icon[8] = new ImageIcon("images\\p9.jpg");
        icon[9] = new ImageIcon("images\\p10.jpg");
        break;
      case 2:
        icon[0] = new ImageIcon("images\\s1.jpg");
        icon[1] = new ImageIcon("images\\s2.jpg");
        icon[2] = new ImageIcon("images\\s3.jpg");
        icon[3] = new ImageIcon("images\\s4.jpg");
        icon[4] = new ImageIcon("images\\s5.jpg");
        icon[5] = new ImageIcon("images\\s6.jpg");
        icon[6] = new ImageIcon("images\\s7.jpg");
        icon[7] = new ImageIcon("images\\s8.jpg");
        icon[8] = new ImageIcon("images\\s9.jpg");
        icon[9] = new ImageIcon("images\\s10.jpg");
    }

    // generating random number for random image generation
    for (int k = 0; k < 20; k++) {
      int rno = r.nextInt(10);
      randomNo[rno] += 1;
      if (randomNo[rno] <= 2) i[k] = rno;
      else k -= 1;
    }

    // make components
    butnPlayAgn = new JButton("PlayAgain!!!");
    butnQuit = new JButton("Quit");

    for (int j = 0; j < 20; j++) butI[j] = new JButton(iconOrg);

    lblTotPress = new JLabel("Number of Clicks:");

    Font f = new Font("Comic Sans MS", Font.BOLD, 20);
    lblTotPressVal = new JLabel("");
    lblTotPressVal.setFont(f);
    lblTotPressVal.setForeground(Color.BLUE);

    lblTime = new JLabel("Time:");
    lblTimeVal = new JLabel("");
    lblTimeVal.setFont(f);
    lblTimeVal.setForeground(Color.BLUE);

    lblCongrt = new JLabel("");
    lblCongrt.setFont(f);
    lblCongrt.setForeground(Color.BLUE);

    lblContestant = new JLabel("");
    lblContestant.setFont(f);
    lblContestant.setForeground(Color.BLUE);

    // put components in window
    for (int j = 0; j < 20; j++) add(butI[j]);
    add(butnPlayAgn);
    add(butnQuit);
    add(lblTotPress);
    add(lblTotPressVal);
    add(lblTime);
    add(lblTimeVal);
    add(lblCongrt);
    add(lblContestant);

    // arrange components
    setLayout(null);
    int x = 60, y = 40;
    for (int j = 0; j < 20; j++) {
      if (j % 4 == 0) {
        y += 80;
        x = 60;
      }
      x += 80;
      butI[j].setBounds(x, y, 60, 60);
    }

    butnPlayAgn.setBounds(190, 360, 100, 30);
    butnPlayAgn.setVisible(false);
    butnQuit.setBounds(310, 360, 100, 30);
    butnQuit.setVisible(false);
    lblTotPress.setBounds(50, 600, 100, 30);
    lblTotPressVal.setBounds(155, 600, 30, 30);
    lblTime.setBounds(400, 600, 40, 30);
    lblTimeVal.setBounds(445, 600, 60, 30);
    lblContestant.setBounds(100, 200, 300, 50);
    lblContestant.setVisible(false);
    lblCongrt.setBounds(100, 250, 400, 50);
    lblCongrt.setVisible(false);

    // associate the event procedure
    for (int j = 0; j < 20; j++) butI[j].addActionListener(this);

    butnPlayAgn.addActionListener(this);
    butnQuit.addActionListener(this);
  }
コード例 #20
0
  /** Creates a file conversation component. */
  public FileTransferConversationComponent() {
    imageLabel = new FileImageLabel();

    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 4;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.insets = new Insets(5, 5, 5, 5);

    add(imageLabel, constraints);
    imageLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.DEFAULT_FILE_ICON)));

    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.gridwidth = 3;
    constraints.gridheight = 1;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1.0;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.insets = new Insets(5, 5, 5, 5);

    add(titleLabel, constraints);
    titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 11f));

    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 5, 5, 5);

    add(fileLabel, constraints);

    constraints.gridx = 1;
    constraints.gridy = 2;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 5, 0, 5);
    constraints.fill = GridBagConstraints.NONE;

    add(errorIconLabel, constraints);
    errorIconLabel.setVisible(false);

    constraints.gridx = 2;
    constraints.gridy = 2;
    constraints.gridwidth = 2;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 5, 0, 5);
    constraints.fill = GridBagConstraints.HORIZONTAL;

    add(errorArea, constraints);
    errorArea.setForeground(new Color(resources.getColor("service.gui.ERROR_FOREGROUND")));
    setTextAreaStyle(errorArea);
    errorArea.setVisible(false);

    constraints.gridx = 1;
    constraints.gridy = 3;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0.0;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 5, 0, 5);

    add(retryButton, constraints);
    retryButton.setText(GuiActivator.getResources().getI18NString("service.gui.RETRY"));
    retryButton.setVisible(false);

    constraints.gridx = 1;
    constraints.gridy = 3;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0.0;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 5, 0, 5);

    add(cancelButton, constraints);
    cancelButton.setText(GuiActivator.getResources().getI18NString("service.gui.CANCEL"));
    cancelButton.addActionListener(this);
    cancelButton.setVisible(false);

    constraints.gridx = 2;
    constraints.gridy = 3;
    constraints.gridwidth = GridBagConstraints.RELATIVE;
    constraints.gridheight = 1;
    constraints.weightx = 0.0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.EAST;
    constraints.insets = new Insets(0, 5, 0, 5);

    constraints.gridx = 3;
    constraints.gridy = 3;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0.0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.LINE_END;
    constraints.insets = new Insets(0, 5, 0, 5);

    add(progressPropertiesPanel, constraints);

    estimatedTimeLabel.setFont(estimatedTimeLabel.getFont().deriveFont(11f));
    estimatedTimeLabel.setVisible(false);
    progressSpeedLabel.setFont(progressSpeedLabel.getFont().deriveFont(11f));
    progressSpeedLabel.setVisible(false);

    progressPropertiesPanel.add(progressSpeedLabel);
    progressPropertiesPanel.add(estimatedTimeLabel);

    constraints.gridx = 1;
    constraints.gridy = 3;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0.0;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 5, 0, 5);
    constraints.fill = GridBagConstraints.NONE;

    add(acceptButton, constraints);
    acceptButton.setText(GuiActivator.getResources().getI18NString("service.gui.ACCEPT"));
    acceptButton.setVisible(false);

    constraints.gridx = 2;
    constraints.gridy = 3;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0.0;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 5, 0, 5);
    constraints.fill = GridBagConstraints.NONE;

    add(rejectButton, constraints);
    rejectButton.setText(GuiActivator.getResources().getI18NString("service.gui.REJECT"));
    rejectButton.setVisible(false);

    constraints.gridx = 1;
    constraints.gridy = 3;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0.0;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 5, 0, 5);
    constraints.fill = GridBagConstraints.NONE;

    add(openFileButton, constraints);
    openFileButton.setText(GuiActivator.getResources().getI18NString("service.gui.OPEN"));
    openFileButton.setVisible(false);
    openFileButton.addActionListener(this);

    constraints.gridx = 2;
    constraints.gridy = 3;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0.0;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 5, 0, 5);
    constraints.fill = GridBagConstraints.NONE;

    add(openFolderButton, constraints);
    openFolderButton.setText(GuiActivator.getResources().getI18NString("service.gui.OPEN_FOLDER"));
    openFolderButton.setVisible(false);
    openFolderButton.addActionListener(this);

    constraints.gridx = 1;
    constraints.gridy = 2;
    constraints.gridwidth = 3;
    constraints.gridheight = 1;
    constraints.weightx = 1.0;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 5, 0, 5);
    constraints.ipadx = 150;
    constraints.fill = GridBagConstraints.HORIZONTAL;

    add(progressBar, constraints);
    progressBar.setVisible(false);
    progressBar.setStringPainted(true);
  }
コード例 #21
0
ファイル: TextArea.java プロジェクト: tzkiki32/quollwriter
  public TextArea(String placeholder, int rows, int maxChars) {

    super(BoxLayout.Y_AXIS);

    this.text = UIUtils.createTextArea(rows);

    if (placeholder != null) {

      this.placeholder = Environment.replaceObjectNames(placeholder);
      this.text.setText(this.placeholder);
      this.text.setForeground(UIUtils.getHintTextColor());
    }

    this.maxChars = maxChars;

    final TextArea _this = this;

    final JLabel maxText = new JLabel("Max " + Environment.formatNumber(maxChars) + " characters");
    maxText.setForeground(UIUtils.getHintTextColor());

    this.scrollPane = UIUtils.createScrollPane((JComponent) this.text);

    this.text.addKeyListener(
        new KeyAdapter() {

          public void keyPressed(KeyEvent ev) {

            if (_this.text.getForeground() != Color.BLACK) {

              _this.text.setText("");
            }

            _this.text.setForeground(Color.BLACK);

            if (_this.maxChars <= 0) {

              return;
            }

            maxText.setForeground(UIUtils.getHintTextColor());

            int l = _this.text.getText().trim().length();

            String t = "Max " + Environment.formatNumber(_this.maxChars) + " characters";

            if (l > 0) {

              if (l > 5000) {

                t += ", over " + Environment.formatNumber(_this.maxChars) + " characters";
                maxText.setForeground(Color.RED);

              } else {

                t += ", " + Environment.formatNumber((5000 - l)) + " remaining";
              }
            }

            maxText.setText(t);
          }
        });

    this.text.addMouseListener(
        new MouseEventHandler() {

          @Override
          public void mouseEntered(MouseEvent ev) {

            if ((!_this.text.getText().equals("")) && (_this.text.getForeground() != Color.BLACK)) {

              _this.text.getCaret().setDot(0);
            }

            if (_this.isAutoGrabFocus()) {

              _this.text.grabFocus();
            }
          }

          @Override
          public void handlePress(MouseEvent ev) {

            if ((!_this.text.getText().equals("")) && (_this.text.getForeground() == Color.BLACK)) {

              return;
            }

            _this.text.setText("");
            _this.text.setForeground(Color.BLACK);
          }
        });

    this.add(this.scrollPane);

    this.add(maxText);

    if (this.maxChars <= 0) {

      maxText.setVisible(false);
    }
  }
コード例 #22
0
ファイル: FrameModules.java プロジェクト: RubelAhmed57/KEEL
 // Exit button
 void exit_mouseEntered(MouseEvent e) {
   labelSalir.setVisible(true);
 }
コード例 #23
0
ファイル: FrameModules.java プロジェクト: RubelAhmed57/KEEL
  /**
   * Initialize frame
   *
   * @throws java.lang.Exception
   */
  private void initializeModulesFrame() throws Exception {
    // frame initialization
    this.setFont(new java.awt.Font("Arial", 0, 11));
    this.setIconImage(
        Toolkit.getDefaultToolkit()
            .getImage(
                this.getClass().getResource("/keel/GraphInterKeel/resources/ico/logo/logo.gif")));
    this.setSize(new Dimension(640, 480));
    this.setTitle("Keel");
    this.setResizable(false);

    // Create panel
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(null);

    // panel background
    fondo.setText("");
    fondo.setBounds(new Rectangle(0, 0, 640, 480));
    fondo.setFont(new java.awt.Font("Arial", 0, 11));
    fondo.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/fondo.gif")));

    exit.setText("Exit KEEL");
    exit.setBounds(new Rectangle(294, 327, 129, 36));
    exit.setFont(new java.awt.Font("Arial", 0, 11));

    // labels associated to buttons
    labelSalir.setFont(new java.awt.Font("Arial", 1, 18));
    labelSalir.setForeground(Color.white);
    labelSalir.setText("Exit KEEL");
    labelSalir.setBounds(new Rectangle(40, 412, 595, 27));
    labelSalir.setVisible(false);

    labelBack.setFont(new java.awt.Font("Arial", 1, 18));
    labelBack.setForeground(Color.white);
    labelBack.setText("Back to Keel Suite Menu");
    labelBack.setBounds(new Rectangle(40, 412, 595, 27));
    labelBack.setVisible(false);

    labelLQD.setFont(new java.awt.Font("Arial", 1, 18));
    labelLQD.setForeground(Color.white);
    labelLQD.setText("Experiments Design with Low Quality Data");
    labelLQD.setBounds(new Rectangle(40, 412, 465, 27));
    labelLQD.setVisible(false);

    labelImbalance.setFont(new java.awt.Font("Arial", 1, 18));
    labelImbalance.setForeground(Color.white);
    labelImbalance.setText("Experiments with Imbalanced Datasets");
    labelImbalance.setBounds(new Rectangle(40, 412, 465, 27));
    labelImbalance.setVisible(false);

    labelNonParametric.setFont(new java.awt.Font("Arial", 1, 18));
    labelNonParametric.setForeground(Color.white);
    labelNonParametric.setText("Non-Parametric Statistical Analysis");
    labelNonParametric.setBounds(new Rectangle(40, 412, 465, 27));
    labelNonParametric.setVisible(false);

    labelSSL.setFont(new java.awt.Font("Arial", 1, 18));
    labelSSL.setForeground(Color.white);
    labelSSL.setText("Semi-Supervised Learning");
    labelSSL.setBounds(new Rectangle(40, 412, 465, 27));
    labelSSL.setVisible(false);

    labelMil.setFont(new java.awt.Font("Arial", 1, 17));
    labelMil.setForeground(Color.white);
    labelMil.setText("Experiments with Multiple Instance Learning");
    labelMil.setBounds(new Rectangle(40, 412, 465, 27));
    labelMil.setVisible(false);

    contentPane.setFont(new java.awt.Font("Arial", 0, 11));

    keel.setText("");
    keel.setBounds(new Rectangle(160, 13, 336, 33));
    keel.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/mod.png")));
    logotipo.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/logotipo.png")));
    logotipo.setBounds(new Rectangle(550, 13, 65, 43));
    logotipo.addMouseListener(new FrameModules_logotipo_mouseAdapter(this));

    logotipoSoft.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/Software.png")));
    logotipoSoft.setBounds(new Rectangle(30, 13, 75, 43));
    logotipoSoft.addMouseListener(new FrameModules_logotipoSoft_mouseAdapter(this));

    barraExit.setBounds(new Rectangle(0, 401, 751, 50));
    barraExit.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/exit.png")));
    accionExit.setText("jLabel2");
    accionExit.setBounds(new Rectangle(536, 409, 94, 38));
    accionExit.addMouseListener(new FrameModules_accionExit_mouseAdapter(this));

    back.setBounds(new Rectangle(406, 409, 110, 38));
    back.addMouseListener(new FrameModules_back_mouseAdapter(this));

    // lqd.setBounds(new Rectangle(50, 140, 244, 40));
    lqd.setBounds(new Rectangle(50, 120, 244, 40));
    lqd.addMouseListener(new Frame_lqd_mouseAdapter(this));

    // imbalance.setBounds(new Rectangle(50, 200, 264, 38));
    imbalance.setBounds(new Rectangle(50, 180, 264, 38));
    imbalance.addMouseListener(new Frame_imbalance_mouseAdapter(this));

    // nonParametric.setBounds(new Rectangle(50, 260, 400, 42));
    nonParametric.setBounds(new Rectangle(50, 240, 400, 42));
    nonParametric.addMouseListener(new Frame_nonParametric_mouseAdapter(this));

    SSL.setBounds(new Rectangle(50, 300, 400, 42));
    SSL.addMouseListener(new Frame_SSL_mouseAdapter(this));

    //  mil.setBounds(new Rectangle(50, 320, 400, 42));
    mil.setBounds(new Rectangle(50, 360, 400, 42));
    mil.addMouseListener(new Frame_mil_mouseAdapter(this));

    lqd.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/lqd.png")));
    imbalance.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/imbalance.png")));
    nonParametric.setIcon(
        new ImageIcon(
            this.getClass()
                .getResource("/keel/GraphInterKeel/resources/imag/menu/nonParametric.png")));
    SSL.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/SSL.png")));
    mil.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/mil.png")));
    back.setIcon(
        new ImageIcon(
            this.getClass().getResource("/keel/GraphInterKeel/resources/imag/menu/back.png")));

    contentPane.add(back, null);
    contentPane.add(labelBack, null);

    contentPane.add(labelSalir, null);
    contentPane.add(labelLQD2, null);
    contentPane.add(labelLQD, null);
    contentPane.add(labelImbalance, null);
    contentPane.add(labelNonParametric, null);
    contentPane.add(labelSSL, null);
    contentPane.add(labelMil, null);
    // contentPane.add(lqd);
    contentPane.add(mil);
    contentPane.add(imbalance);
    contentPane.add(nonParametric);
    contentPane.add(SSL);
    contentPane.add(keel);
    contentPane.add(logotipo);
    contentPane.add(logotipoSoft);
    contentPane.add(barraExit);
    contentPane.add(fondo, null);
    contentPane.add(accionExit);
  }
コード例 #24
0
 /** Hides all progress related components. */
 protected void hideProgressRelatedComponents() {
   progressBar.setVisible(false);
   progressSpeedLabel.setVisible(false);
   estimatedTimeLabel.setVisible(false);
 }
コード例 #25
0
ファイル: Gui.java プロジェクト: hygzhu/java-incremental-game
  // gui constructor
  public Gui() throws IOException {

    // sets frame text and features
    super("Doge Clicker 1.0");
    this.setIconImage(new ImageIcon("Images//doge.jpg").getImage());

    // initializes sound files
    Sounds.initialize();

    // gui dimensions and features
    setSize(1000, 700);
    setResizable(false);
    setLayout(null);
    Container c = getContentPane();
    c.setBackground(new Color(255, 255, 255));
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    // timer for doge per second run method runs every millisecond
    timer = new Timer();
    timer.schedule(new RemindTask(), 1000, 10);

    // bolded title
    title = new JLabel("Doge Clicker v1.0");
    title.setBounds(0, 0, getWidth(), 40);
    title.setFont(new Font("Comic Sans MS", Font.BOLD, 26));
    title.setForeground(Color.white);
    title.setHorizontalAlignment(JLabel.CENTER);
    add(title);

    // reads news.txt to have import text to array
    String filePath = "Data\\news.txt";
    BufferedReader fileIn = new BufferedReader(new FileReader(filePath));
    for (int i = 0; i < line.length; i++) {

      // reads lines and saves until done reading
      if ((line[i] = fileIn.readLine()) != null) {}
    }
    fileIn.close(); // close file

    // read flavor text.txt to import text to array
    filePath = "Data\\flavourtext.txt";
    fileIn = new BufferedReader(new FileReader(filePath));
    for (int i = 0; i < flavourText.length; i++) {

      // reads lines until complety reading
      if ((flavourText[i] = fileIn.readLine()) != null) {}
    }
    fileIn.close();

    // flavour label that pops up randomly when doge is clicked
    flavourClick = new JLabel("Wow! Such click!");
    flavourClick.setBounds(400, 100, getWidth(), getHeight());
    flavourClick.setFont(new Font("Comic Sans MS", Font.BOLD, 25));
    flavourClick.setForeground(Color.white);
    flavourClick.setOpaque(false);
    add(flavourClick);

    // label for achievements
    achievementText = new JLabel("These are your achievements");
    achievementText.setBounds(75, 2, getWidth(), 15);
    achievementText.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    achievementText.setForeground(Color.white);
    add(achievementText);

    // label for doge buying and click upgrades
    dogeProducers = new JLabel("Buy to make more doge");
    dogeProducers.setBounds(50, 160, getWidth(), 40);
    dogeProducers.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    dogeProducers.setForeground(Color.white);
    add(dogeProducers);
    dogeClickers = new JLabel("Miscellaneous upgrades wow");
    dogeClickers.setBounds(700, 160, getWidth(), 40);
    dogeClickers.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    dogeClickers.setForeground(Color.white);
    add(dogeClickers);

    // doge click button
    dogeClick = new JButton(new ImageIcon("Images/doge.jpg"));
    dogeClick.addActionListener(this);
    dogeClick.setBounds(450, 100, 100, 100);
    dogeClick.setOpaque(false);
    dogeClick.setBorder(BorderFactory.createLineBorder(Color.black));
    dogeClick.setToolTipText("Each click gives you " + clickUpgrade + " doge. wow");
    add(dogeClick);

    // click multiplier
    clickMultiplier = new JLabel(multiplier + "x");
    clickMultiplier.setBounds(570, 120, getWidth(), 50);
    clickMultiplier.setFont(new Font("Comic Sans MS", Font.BOLD, 30));
    clickMultiplier.setForeground(Color.white);
    add(clickMultiplier);
    // clicks per second indicator
    cpsIndicator = new JLabel(cps + " clicks per second");
    cpsIndicator.setBounds(570, 150, getWidth(), 50);
    cpsIndicator.setFont(new Font("Comic Sans MS", Font.BOLD, 10));
    cpsIndicator.setForeground(Color.white);
    add(cpsIndicator);

    // event indicator
    eventIndicator = new JLabel("Welcome to doge clicker!");
    eventIndicator.setBounds(700, 530, getWidth(), 50);
    eventIndicator.setFont(new Font("Comic Sans MS", Font.BOLD, 15));
    eventIndicator.setForeground(Color.white);
    add(eventIndicator);

    // states the num of doge and doge per second
    dogeCount = new JLabel("Doge: " + doge);
    dogeCount.setBounds(0, 0, getWidth(), 120);
    dogeCount.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
    dogeCount.setForeground(Color.white);
    dogeCount.setHorizontalAlignment(JLabel.CENTER);
    add(dogeCount);
    dogePerSecond = new JLabel("You get " + dps + " doge per second");
    dogePerSecond.setBounds(0, 25, getWidth(), 120);
    dogePerSecond.setFont(new Font("Comic Sans MS", Font.BOLD, 11));
    dogePerSecond.setForeground(Color.white);
    dogePerSecond.setHorizontalAlignment(JLabel.CENTER);
    add(dogePerSecond);
    dogeClicktext = new JLabel("Click for more doge");
    dogeClicktext.setBounds(400, 185, 200, 50);
    dogeClicktext.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    dogeClicktext.setForeground(Color.white);
    dogeClicktext.setHorizontalAlignment(JLabel.CENTER);
    add(dogeClicktext);
    // doge button testing button
    devButton = new JButton(new ImageIcon());
    devButton.addActionListener(this);
    devButton.setBounds(0, 0, 50, 50);
    devButton.setToolTipText("Such Secret");
    devButton.setOpaque(false);
    devButton.setContentAreaFilled(false);
    devButton.setBorderPainted(false);
    add(devButton);

    // options and save buttons
    options = new JButton(new ImageIcon("Images/option.png"));
    options.addActionListener(this);
    options.setBounds(900, 10, 70, 70);
    options.setOpaque(false);
    options.setBorder(BorderFactory.createLineBorder(Color.black));
    options.setToolTipText("Go to options");
    add(options);
    save = new JButton(new ImageIcon("Images/save.png"));
    save.addActionListener(this);
    save.setBounds(820, 10, 70, 70);
    save.setOpaque(false);
    save.setBorder(BorderFactory.createLineBorder(Color.black));
    save.setToolTipText("Save a file");
    add(save);
    open = new JButton(new ImageIcon("Images/open.png"));
    open.addActionListener(this);
    open.setBounds(740, 10, 70, 70);
    open.setOpaque(false);
    open.setBorder(BorderFactory.createLineBorder(Color.black));
    open.setToolTipText("Open a file");
    add(open);

    // news headline label that will move
    for (int i = 0; i < 3; i++) {

      newsHeadline[i] = new JLabel("Welcome to Doge clicker this is a news headline!");
      newsHeadline[i].setBounds(-200 - (475 * i), 615, getWidth(), 40);
      newsHeadline[i].setFont(new Font("Comic Sans MS", Font.BOLD, 13));
      newsHeadline[i].setForeground(Color.white);
      add(newsHeadline[i]);
    }

    // create all buttons and button stats and labels for producers
    for (int i = 0; i < MAX_UPGRADES; i++) {

      producerStats[i] = new Producers(i);
      producers[i] = new JButton(new ImageIcon(producerStats[i].getImage()));
      producers[i].addActionListener(this);
      producers[i].setOpaque(false);
      producers[i].setBorder(BorderFactory.createLineBorder(Color.black));
      producers[i].setToolTipText(
          "Your "
              + producerStats[i].getButtonName()
              + " gives "
              + producerStats[i].getDogeProduction() * producerStats[i].getCount()
              + " doge per second");
      producers[i].setBounds(0, 0, 70, 70);

      buyProducers[i] =
          new JLabel(
              "Buy "
                  + producerStats[i].getButtonName()
                  + " for "
                  + producerStats[i].getCost()
                  + " doge");
      buyProducers[i].setBounds(0, 0, getWidth(), 100);
      buyProducers[i].setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
      buyProducers[i].setForeground(Color.white);

      buyDetails[i] =
          new JLabel(
              "You have: " + producerStats[i].getCount() + " " + producerStats[i].getButtonName());
      buyDetails[i].setBounds(0, 0, getWidth(), 100);
      buyDetails[i].setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
      buyDetails[i].setForeground(Color.white);
    }
    // buttons and labels for click upgrades clickers
    for (int i = 0; i < MAX_CLICK; i++) {

      clickerStats[i] = new Clickers(i);
      clickers[i] = new JButton(new ImageIcon(clickerStats[i].getImage()));
      clickers[i].addActionListener(this);
      if (clickerStats[i].getClickMultiplier() == 1) {
        clickers[i].setToolTipText(
            "Buy this "
                + clickerStats[i].getButtonName()
                + " to get +"
                + clickerStats[i].getClickBonus()
                + " doge per click");
      } else {
        clickers[i].setToolTipText(
            "Buy this "
                + clickerStats[i].getButtonName()
                + " to get x"
                + clickerStats[i].getClickMultiplier()
                + " doge per click");
      }
      clickers[i].setOpaque(false);
      clickers[i].setBorder(BorderFactory.createLineBorder(Color.black));
      clickers[i].setBounds(0, 0, 70, 70);

      buyClickers[i] =
          new JLabel(
              "Buy "
                  + clickerStats[i].getButtonName()
                  + " for "
                  + clickerStats[i].getCost()
                  + " doge");
      buyClickers[i].setBounds(0, 0, getWidth(), 100);
      buyClickers[i].setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
      buyClickers[i].setForeground(Color.white);
    }

    // labels for achievements
    for (int i = 0; i < MAX_ACHIEVEMENTS; i++) {
      achievementStats[i] = new Achievements(i);
      achievements[i] = new JLabel(new ImageIcon(achievementStats[i].getImage()));
      achievements[i].setBorder(BorderFactory.createLineBorder(Color.black));
      achievements[i].setToolTipText("Achievement: " + achievementStats[i].getButtonName());
      achievements[i].setBounds(0, 0, 70, 70);
    }

    // JPanel containing achievements
    JPanel achievementPanel = new JPanel();
    achievementPanel.setPreferredSize(new Dimension(350, 70));
    achievementPanel.setLayout(null);
    achievementPanel.setOpaque(false);

    // JScrollpane containing JPanel for achievements
    JScrollPane achievementDisplay = new JScrollPane();
    achievementDisplay.setViewportBorder(new LineBorder(Color.black));
    achievementDisplay.setSize(280, 90);
    achievementDisplay.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    achievementDisplay.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    achievementDisplay.getVerticalScrollBar().setUnitIncrement(10);
    achievementDisplay.setLocation(50, 20);
    achievementDisplay.setOpaque(false);
    add(achievementDisplay);

    // adds the panel
    achievementDisplay.getViewport().add(achievementPanel);
    achievementDisplay.getViewport().setOpaque(false);

    // adds all achievements
    for (int i = 0; i < MAX_ACHIEVEMENTS; i++) {

      achievementPanel.add(achievements[i]);
      achievements[i].setLocation(0 + i * 70, 0);
      achievements[i].setVisible(false);
    }

    // jpanel containing upgrades for producers
    JPanel upgradePanel = new JPanel();
    upgradePanel.setPreferredSize(new Dimension(350, 770));
    upgradePanel.setLayout(null);
    upgradePanel.setOpaque(false);

    // Jscrollpane containing jpanel for producers
    JScrollPane producerUpgrades = new JScrollPane();
    producerUpgrades.setViewportBorder(new LineBorder(Color.black));
    producerUpgrades.setSize(350, 300);
    producerUpgrades.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    producerUpgrades.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    producerUpgrades.getVerticalScrollBar().setUnitIncrement(10);
    producerUpgrades.setLocation(0, 200);
    producerUpgrades.setOpaque(false);
    add(producerUpgrades);

    producerUpgrades.getViewport().setOpaque(false);
    producerUpgrades.getViewport().add(upgradePanel);

    // adds all upgrades
    for (int i = 0; i < MAX_UPGRADES; i++) {

      upgradePanel.add(producers[i]);
      producers[i].setLocation(0, (i) * 70);
      upgradePanel.add(buyProducers[i]);
      buyProducers[i].setLocation(90, (i * 70) - 35);
      upgradePanel.add(buyDetails[i]);
      buyDetails[i].setLocation(90, (i * 70) - 20);
    }

    // jpanel containing upgrades for clickers
    JPanel clickPanel = new JPanel();
    clickPanel.setPreferredSize(new Dimension(350, 350));
    clickPanel.setLayout(null);
    clickPanel.setOpaque(false);

    // Jscrollpane containing jpanel for clickers
    JScrollPane clickUpgrades = new JScrollPane();
    clickUpgrades.setViewportBorder(new LineBorder(Color.black));
    clickUpgrades.setSize(350, 300);
    clickUpgrades.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    clickUpgrades.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    clickUpgrades.getVerticalScrollBar().setUnitIncrement(10);
    clickUpgrades.setLocation(650, 200);
    clickUpgrades.setOpaque(false);
    add(clickUpgrades);
    clickUpgrades.getViewport().add(clickPanel);
    clickUpgrades.getViewport().setOpaque(false);

    // adds all click upgrades
    for (int i = 0; i < MAX_CLICK; i++) {

      clickPanel.add(clickers[i]);
      clickers[i].setLocation(0, (i) * 70);
      clickPanel.add(buyClickers[i]);
      buyClickers[i].setLocation(80, (i * 70) - 30);
    }

    // dancing snoop dog image
    JLabel snoop = new JLabel(new ImageIcon("Images//snoop.gif"));
    snoop.setBounds(450, 370, 150, 308);
    snoop.setOpaque(false);
    add(snoop);

    // background image
    JLabel background = new JLabel(new ImageIcon("Images//dogebackground.png"));
    background.setBounds(0, 0, 1000, 700);
    add(background);

    // makes everything above visible
    setVisible(true);
    // flavour click will remain invisible
    flavourClick.setVisible(false);

    // timer for news headline, runs every 20 milliseconds
    MyTimerTask task = new MyTimerTask();
    Timer newsTimer = new Timer();
    newsTimer.scheduleAtFixedRate(task, 0, 20);
  }
コード例 #26
0
 private void clearWarningAndEnableOK() {
   myMaskWarningLabel.setVisible(false);
   setOKActionEnabled(true);
 }
コード例 #27
0
  /** This method is called from within the constructor to initialize the form. */
  public void initComponents() {

    /** **************** The components ********************************* */
    firstPanel = new JPanel();
    firstPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 2));
    // If put to False: we see the container's background
    firstPanel.setOpaque(false);
    // rows, columns, horizontalGap, verticalGap
    firstPanel.setLayout(new GridLayout(4, 2, 3, 3));
    this.setLayout(new GridLayout(2, 1, 3, 3));
    this.add(firstPanel);

    proxyStackNameLabel = new JLabel("Proxy stack name:");
    proxyStackNameLabel.setToolTipText("The name of the stack to set");
    // Alignment of the text
    proxyStackNameLabel.setHorizontalAlignment(AbstractButton.CENTER);
    // Color of the text
    proxyStackNameLabel.setForeground(Color.black);
    // Size of the text
    proxyStackNameLabel.setFont(new Font("Dialog", 1, 12));
    // If put to true: we see the label's background
    proxyStackNameLabel.setOpaque(true);
    proxyStackNameLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    proxyStackNameLabel.setBorder(ProxyLauncher.labelBorder);
    proxyStackNameTextField = new JTextField(20);
    proxyStackNameTextField.setHorizontalAlignment(AbstractButton.CENTER);
    proxyStackNameTextField.setFont(new Font("Dialog", 0, 14));
    proxyStackNameTextField.setBackground(ProxyLauncher.textBackGroundColor);
    proxyStackNameTextField.setForeground(Color.black);
    proxyStackNameTextField.setBorder(BorderFactory.createLoweredBevelBorder());
    firstPanel.add(proxyStackNameLabel);
    firstPanel.add(proxyStackNameTextField);

    proxyIPAddressLabel = new JLabel("Proxy IP address:");
    proxyIPAddressLabel.setToolTipText("The address of the proxy to set");
    // Alignment of the text
    proxyIPAddressLabel.setHorizontalAlignment(AbstractButton.CENTER);
    // Color of the text
    proxyIPAddressLabel.setForeground(Color.black);
    // Size of the text
    proxyIPAddressLabel.setFont(new Font("Dialog", 1, 12));
    // If put to true: we see the label's background
    proxyIPAddressLabel.setOpaque(true);
    proxyIPAddressLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    proxyIPAddressLabel.setBorder(ProxyLauncher.labelBorder);
    proxyIPAddressTextField = new JTextField(20);
    proxyIPAddressTextField.setHorizontalAlignment(AbstractButton.CENTER);
    proxyIPAddressTextField.setFont(new Font("Dialog", 0, 14));
    proxyIPAddressTextField.setBackground(ProxyLauncher.textBackGroundColor);
    proxyIPAddressTextField.setForeground(Color.black);
    proxyIPAddressTextField.setBorder(BorderFactory.createLoweredBevelBorder());
    firstPanel.add(proxyIPAddressLabel);
    firstPanel.add(proxyIPAddressTextField);

    outboundProxyLabel = new JLabel("Next hop (IP:port/protocol):");
    outboundProxyLabel.setToolTipText(
        "Location where the message will be sent "
            + "if all the resolutions (DNS, router,...) fail. If not set: 404 will be replied");
    // Alignment of the text
    outboundProxyLabel.setHorizontalAlignment(AbstractButton.CENTER);
    // Color of the text
    outboundProxyLabel.setForeground(Color.black);
    // Size of the text
    outboundProxyLabel.setFont(new Font("Dialog", 1, 12));
    // If put to true: we see the label's background
    outboundProxyLabel.setOpaque(true);
    outboundProxyLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    outboundProxyLabel.setBorder(ProxyLauncher.labelBorder);
    outboundProxyTextField = new JTextField(20);
    outboundProxyTextField.setHorizontalAlignment(AbstractButton.CENTER);
    outboundProxyTextField.setFont(new Font("Dialog", 0, 14));
    outboundProxyTextField.setBackground(ProxyLauncher.textBackGroundColor);
    outboundProxyTextField.setForeground(Color.black);
    outboundProxyTextField.setBorder(BorderFactory.createLoweredBevelBorder());
    firstPanel.add(outboundProxyLabel);
    firstPanel.add(outboundProxyTextField);

    routerClassLabel = new JLabel("The Router class name:");
    routerClassLabel.setToolTipText(
        "The class name (full java package name) of the router" + " used to forward the messages");
    // Alignment of the text
    routerClassLabel.setHorizontalAlignment(AbstractButton.CENTER);
    // Color of the text
    routerClassLabel.setForeground(Color.black);
    // Size of the text
    routerClassLabel.setFont(new Font("Dialog", 1, 12));
    // If put to true: we see the label's background
    routerClassLabel.setOpaque(true);
    routerClassLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    routerClassLabel.setBorder(ProxyLauncher.labelBorder);
    routerClassTextField = new JTextField(20);
    routerClassTextField.setHorizontalAlignment(AbstractButton.CENTER);
    routerClassTextField.setFont(new Font("Dialog", 0, 12));
    routerClassTextField.setBackground(ProxyLauncher.textBackGroundColor);
    routerClassTextField.setForeground(Color.black);
    routerClassTextField.setBorder(BorderFactory.createLoweredBevelBorder());
    firstPanel.add(routerClassLabel);
    firstPanel.add(routerClassTextField);

    JPanel panel = new JPanel();
    // top, left, bottom, right
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 2));
    // If put to False: we see the container's background
    panel.setOpaque(false);
    // rows, columns, horizontalGap, verticalGap
    panel.setLayout(new BorderLayout());
    this.add(panel);

    JLabel lpLabel = new JLabel("Listening points list:");
    lpLabel.setVisible(true);
    lpLabel.setToolTipText("The listening points of the proxy");
    lpLabel.setHorizontalAlignment(AbstractButton.CENTER);
    lpLabel.setForeground(Color.black);
    lpLabel.setFont(new Font("Dialog", 1, 12));
    lpLabel.setOpaque(true);
    lpLabel.setBackground(ProxyLauncher.labelBackGroundColor);
    lpLabel.setBorder(ProxyLauncher.labelBorder);
    panel.add(lpLabel, BorderLayout.NORTH);

    // this.add(listeningPointsList);
    JScrollPane scrollPane =
        new JScrollPane(
            listeningPointsList,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    panel.add(scrollPane, BorderLayout.CENTER);

    thirdPanel = new JPanel();
    thirdPanel.setOpaque(false);
    // top, left, bottom, right
    thirdPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 5, 0));
    thirdPanel.setLayout(new GridLayout(1, 2, 3, 3));

    JButton addLPButton = new JButton(" Add ");
    addLPButton.setToolTipText("Add a listening point");
    addLPButton.setFocusPainted(false);
    addLPButton.setFont(new Font("Dialog", 1, 16));
    addLPButton.setBackground(ProxyLauncher.buttonBackGroundColor);
    addLPButton.setBorder(ProxyLauncher.buttonBorder);
    addLPButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            addLPButtonActionPerformed(evt);
          }
        });
    thirdPanel.add(addLPButton);

    JButton removeLPButton = new JButton(" Remove ");
    removeLPButton.setToolTipText("Remove a listening point");
    removeLPButton.setFocusPainted(false);
    removeLPButton.setFont(new Font("Dialog", 1, 16));
    removeLPButton.setBackground(ProxyLauncher.buttonBackGroundColor);
    removeLPButton.setBorder(ProxyLauncher.buttonBorder);
    removeLPButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            removeLPButtonActionPerformed(evt);
          }
        });
    thirdPanel.add(removeLPButton);

    panel.add(thirdPanel, BorderLayout.SOUTH);
  }
コード例 #28
0
  public void actionPerformed(ActionEvent e) {
    SpinnerNumberModel m = ((SpinnerNumberModel) daysnr.getModel());
    int days = m.getNumber().intValue();
    String location = ((JTextField) loc).getText();
    java.util.List<PointOfInterest> points = parent.textFieldPoints(location);
    if (!points.isEmpty()) {
      double latitude = points.get(0).getLatlon().latitude.getDegrees(),
          longitude = points.get(0).getLatlon().longitude.getDegrees();
      // we want only the firs two decimals
      latitude = ((double) ((long) (latitude * 100))) / 100;
      longitude = ((double) ((long) (latitude * 100))) / 100;
      String APIKey = "65ea00ff33143650113112";
      String address =
          "http://free.worldweatheronline.com/feed/weather.ashx?"
              + "key="
              + APIKey
              + "&num_of_days="
              + days
              + "&q="
              + latitude
              + ","
              + longitude
              + "&format=json&cc=no";
      try {
        URL link = new URL(address);
        URLConnection yc = link.openConnection();
        BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
        Vector<WeatherElements> elem = new Vector<WeatherElements>();
        String jsonFile = in.readLine();
        int i1 = 0, i2 = 0;
        for (int i = 0; i < days; i++) {
          i1 = jsonFile.indexOf("\"date\"", i2) + 9;
          i2 = jsonFile.indexOf("\"", i1);
          String date = jsonFile.substring(i1, i2);
          i2++;

          i1 = jsonFile.indexOf("\"precipMM\"", i2) + 13;
          i2 = jsonFile.indexOf("\"", i1);
          String rain = jsonFile.substring(i1, i2);
          i2++;

          i1 = jsonFile.indexOf("\"tempMaxC\"", i2) + 13;
          i2 = jsonFile.indexOf("\"", i1);
          String tempMax = jsonFile.substring(i1, i2);
          i2++;

          i1 = jsonFile.indexOf("\"tempMinC\"", i2) + 13;
          i2 = jsonFile.indexOf("\"", i1);
          String tempMin = jsonFile.substring(i1, i2);
          i2++;

          i1 = jsonFile.indexOf("\"value\"", i2) + 10;
          i2 = jsonFile.indexOf("\"", i1);
          String weatherStatus = jsonFile.substring(i1, i2);
          i2++;

          i1 = jsonFile.indexOf("\"value\"", i2) + 10;
          i2 = jsonFile.indexOf("\"", i1);
          String imgLink = jsonFile.substring(i1, i2);
          imgLink = imgLink.replace("\\", "");
          i2++;

          i1 = jsonFile.indexOf("\"winddirDegree\"", i2) + 18;
          i2 = jsonFile.indexOf("\"", i1);
          String windDirDegree = jsonFile.substring(i1, i2);
          i2++;

          i1 = jsonFile.indexOf("\"winddirection\"", i2) + 18;
          i2 = jsonFile.indexOf("\"", i1);
          String windDir = jsonFile.substring(i1, i2);
          i2++;

          i1 = jsonFile.indexOf("\"windspeedKmph\"", i2) + 18;
          i2 = jsonFile.indexOf("\"", i1);
          String windSpeed = jsonFile.substring(i1, i2);
          i2++;

          WeatherElements o =
              new WeatherElements(
                  date,
                  rain,
                  tempMax,
                  tempMin,
                  weatherStatus,
                  imgLink,
                  windDirDegree,
                  windDir,
                  windSpeed);
          elem.add(o);
        }

        weatherIcon.setVisible(true);
        dateout.setText(elem.elementAt(0).date);
        weatherIcon.setText("<html><img src=\"" + elem.elementAt(0).imgLink + "\" /></html>");
        weatherstatus.setText("<html><h1>" + elem.elementAt(0).weatherStatus + "</h1></html>");
        temperature.setText(
            "<html>Temperatures:<br />Temp min: "
                + elem.elementAt(0).tempMin
                + "°C<br />Temp max: "
                + elem.elementAt(0).tempMax
                + "°C</html>");
        rain.setText("Rain: " + elem.elementAt(0).rain + " mm");
        wind.setText(
            "<html>Wind: <br />"
                + "<img src=\"http://www.worldweatheronline.com"
                + "/App_Themes/Default/images/wind/"
                + elem.elementAt(0).windDir
                + ".png\" /><br />"
                + "Wind speed: "
                + elem.elementAt(0).windSpeed
                + "Km/h<br />"
                + elem.elementAt(0).windDir
                + "("
                + elem.elementAt(0).windDirDegree
                + "°)</html>");

        buttons.removeAll();
        pageNum.removeAll();
        buttons.updateUI();
        pageNum.updateUI();

        JButton previous = new JButton("Previous");
        previous.setEnabled(false);
        previous.setName("prev");

        JButton next = new JButton("Next");
        next.setName("next");

        if (days == 1) {
          next.setEnabled(false);
        }

        JTextField current = new JTextField("1", 3);
        current.setEditable(false);
        JTextField maxNum = new JTextField("" + elem.size(), 3);
        maxNum.setEditable(false);
        pageNum.add(current);
        pageNum.add(maxNum);

        previous.addActionListener(
            new WeatherButtonsActionListener(
                previous,
                next,
                weatherIcon,
                dateout,
                weatherstatus,
                temperature,
                rain,
                wind,
                elem,
                current));
        next.addActionListener(
            new WeatherButtonsActionListener(
                previous,
                next,
                weatherIcon,
                dateout,
                weatherstatus,
                temperature,
                rain,
                wind,
                elem,
                current));
        buttons.add(next);
        buttons.add(previous);
        JButton genHTML = new JButton("Generate HTML");
        genHTML.addActionListener(new genHTMLWeatherReport(parent, elem));
        buttons.add(genHTML);
      } catch (Exception ex) {
        parent.standardDialogBox("Fetching data error", "Somethnig goes wrong with the connection");
      }
    } else {
      parent.standardDialogBox("Incorrect input", "Input is incorrect!");
    }
  }
コード例 #29
0
ファイル: FrameModules.java プロジェクト: RubelAhmed57/KEEL
 void exit_mouseExited(MouseEvent e) {
   labelSalir.setVisible(false);
   exit.setBounds(new Rectangle(15, 340, 129, 36));
 }
コード例 #30
0
 /**
  * Shows the given error message in the error area of this component.
  *
  * @param message the message to show
  */
 protected void showErrorMessage(String message) {
   errorArea.setText(message);
   errorIconLabel.setVisible(true);
   errorArea.setVisible(true);
 }