public void showItem() {

    if (!this.editorPanel.getViewer().isLanguageFunctionAvailable()) {

      return;
    }

    this.highlight =
        this.editorPanel
            .getEditor()
            .addHighlight(this.position, this.position + this.word.length(), null, true);

    final FindSynonymsActionHandler _this = this;

    QTextEditor editor = this.editorPanel.getEditor();

    Rectangle r = null;

    try {

      r = editor.modelToView(this.position);

    } catch (Exception e) {

      // BadLocationException!
      Environment.logError("Location: " + this.position + " is not valid", e);

      UIUtils.showErrorMessage(this.editorPanel, "Unable to display synonyms.");

      return;
    }

    int y = r.y;

    // Show a panel of all the items.
    final QPopup p = this.popup;

    p.setOpaque(false);

    Synonyms syns = null;

    try {

      syns = this.projectViewer.getSynonymProvider().getSynonyms(this.word);

    } catch (Exception e) {

      UIUtils.showErrorMessage(this.editorPanel, "Unable to display synonyms.");

      Environment.logError("Unable to lookup synonyms for: " + word, e);

      return;
    }

    if ((syns.words.size() == 0) && (this.word.toLowerCase().endsWith("ed"))) {

      // Trim off the ed and try again.
      try {

        syns = this.projectViewer.getSynonyms(this.word.substring(0, this.word.length() - 2));

      } catch (Exception e) {

        UIUtils.showErrorMessage(this.editorPanel, "Unable to display synonyms.");

        Environment.logError("Unable to lookup synonyms for: " + word, e);

        return;
      }
    }

    if ((syns.words.size() == 0) && (this.word.toLowerCase().endsWith("s"))) {

      // Trim off the ed and try again.
      try {

        syns = this.projectViewer.getSynonyms(this.word.substring(0, this.word.length() - 1));

      } catch (Exception e) {

        UIUtils.showErrorMessage(this.editorPanel, "Unable to display synonyms.");

        Environment.logError("Unable to lookup synonyms for: " + word, e);

        return;
      }
    }

    StringBuilder sb = new StringBuilder();

    if (syns.words.size() > 0) {

      sb.append("6px");

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

        if (sb.length() > 0) {

          sb.append(", ");
        }

        sb.append("p, 3px, [p,90px], 5px");
      }
      /*
                if (syns.words.size () > 0)
                {

                    sb.append (",5px");

                }
      */
    } else {

      sb.append("6px, p, 6px");
    }

    FormLayout summOnly = new FormLayout("3px, fill:380px:grow, 3px", sb.toString());
    PanelBuilder pb = new PanelBuilder(summOnly);

    CellConstraints cc = new CellConstraints();

    int ind = 2;

    Map<String, String> names = new HashMap();
    names.put(Synonyms.ADJECTIVE + "", "Adjectives");
    names.put(Synonyms.NOUN + "", "Nouns");
    names.put(Synonyms.VERB + "", "Verbs");
    names.put(Synonyms.ADVERB + "", "Adverbs");
    names.put(Synonyms.OTHER + "", "Other");

    if (syns.words.size() == 0) {

      JLabel l = new JLabel("No synonyms found.");
      l.setFont(l.getFont().deriveFont(Font.ITALIC));

      pb.add(l, cc.xy(2, 2));
    }

    // Determine what type of word we are looking for.
    for (Synonyms.Part i : syns.words) {

      JLabel l = new JLabel(names.get(i.type + ""));

      l.setFont(l.getFont().deriveFont(Font.ITALIC));
      l.setFont(l.getFont().deriveFont((float) UIUtils.getEditorFontSize(10)));
      l.setBorder(
          new CompoundBorder(
              new MatteBorder(0, 0, 1, 0, Environment.getBorderColor()),
              new EmptyBorder(0, 0, 3, 0)));

      pb.add(l, cc.xy(2, ind));

      ind += 2;

      HTMLEditorKit kit = new HTMLEditorKit();
      HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();

      JTextPane t = new JTextPane(doc);
      t.setEditorKit(kit);
      t.setEditable(false);
      t.setOpaque(false);

      StringBuilder buf =
          new StringBuilder(
              "<style>a { text-decoration: none; } a:hover { text-decoration: underline; }</style><span style='color: #000000; font-size: "
                  + ((int) UIUtils.getEditorFontSize(10) /*t.getFont ().getSize () + 2*/)
                  + "pt; font-family: "
                  + t.getFont().getFontName()
                  + ";'>");

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

        String w = (String) i.words.get(x);

        buf.append("<a class='x' href='http://" + w + "'>" + w + "</a>");

        if (x < (i.words.size() - 1)) {

          buf.append(", ");
        }
      }

      buf.append("</span>");

      t.setText(buf.toString());

      t.addHyperlinkListener(
          new HyperlinkAdapter() {

            public void hyperlinkUpdate(HyperlinkEvent ev) {

              if (ev.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {

                QTextEditor ed = _this.editorPanel.getEditor();

                ed.replaceText(
                    _this.position, _this.position + _this.word.length(), ev.getURL().getHost());

                ed.removeHighlight(_this.highlight);

                _this.popup.setVisible(false);

                _this.projectViewer.fireProjectEvent(
                    ProjectEvent.SYNONYM, ProjectEvent.REPLACE, ev.getURL().getHost());
              }
            }
          });

      // Annoying that we have to do this but it prevents the text from being too small.

      t.setSize(new Dimension(380, Short.MAX_VALUE));

      JScrollPane sp = new JScrollPane(t);

      t.setCaretPosition(0);

      sp.setOpaque(false);
      sp.getVerticalScrollBar().setValue(0);
      /*
                  sp.setPreferredSize (t.getPreferredSize ());
                  sp.setMaximumSize (new Dimension (380,
                                                    75));
      */
      sp.getViewport().setOpaque(false);
      sp.setOpaque(false);
      sp.setBorder(null);
      sp.getViewport().setBackground(Color.WHITE);
      sp.setAlignmentX(Component.LEFT_ALIGNMENT);

      pb.add(sp, cc.xy(2, ind));

      ind += 2;
    }

    JPanel pan = pb.getPanel();
    pan.setOpaque(true);
    pan.setBackground(Color.WHITE);

    this.popup.setContent(pan);

    // r.y -= this.editorPanel.getScrollPane ().getVerticalScrollBar ().getValue ();

    Point po = SwingUtilities.convertPoint(editor, r.x, r.y, this.editorPanel);

    r.x = po.x;
    r.y = po.y;

    // Subtract the insets of the editorPanel.
    Insets ins = this.editorPanel.getInsets();

    r.x -= ins.left;
    r.y -= ins.top;

    this.editorPanel.showPopupAt(this.popup, r, "above", true);
  }
  public void toChatScreen(String toScreen, boolean selfSeen)
      throws IOException, BadLocationException {
    // Timestamp ts = new Timestamp();
    String toScreenFinal = "";
    Date now = Calendar.getInstance().getTime();
    SimpleDateFormat format = new SimpleDateFormat("hh:mm");
    String ts = format.format(now);

    // chatScreen.append(ts + " " + toScreen + "\n");
    toScreenFinal = "<font color=gray>" + ts + "</font> ";
    if (selfSeen) toScreenFinal = toScreenFinal + "<font color=red>" + toScreen + "</font>";
    else toScreenFinal = toScreenFinal + toScreen;

    // chatter.addTo(toScreen);

    // if(standardWindow) {
    //    chatScreen.setCaretPosition(chatScreen.getDocument().getLength());
    // }
    // else {
    JScrollBar vBar = scrollChat.getVerticalScrollBar();
    int vSize = vBar.getVisibleAmount();
    int maxVBar = vBar.getMaximum();
    int currVBar = vBar.getValue() + vSize;
    kit.insertHTML(doc, doc.getLength(), toScreenFinal, 0, 0, null);
    if (maxVBar == currVBar) {
      chatScreen.setCaretPosition(chatScreen.getDocument().getLength());
    }

    // }

    // kit.insertHTML(doc, doc.getLength(), toScreenFinal, 0, 0, null);

  }
  //
  //  Implement the ChangeListener
  //
  public void stateChanged(ChangeEvent e) {
    //  Keep the scrolling of the row table in sync with main table

    JViewport viewport = (JViewport) e.getSource();
    JScrollPane scrollPane = (JScrollPane) viewport.getParent();
    scrollPane.getVerticalScrollBar().setValue(viewport.getViewPosition().y);
  }
 /** Returns the coordinates of the top left corner of the value at the given index. */
 public Point getCoordinates(int index) {
   JScrollBar bar = scrollPane.getVerticalScrollBar();
   Rectangle r = segmentTable.getCellRect(index, 1, true);
   segmentTable.scrollRectToVisible(r);
   setTopLevelLocation();
   return new Point(
       (int) (r.getX() + topLevelLocation.getX()), (int) (r.getY() + topLevelLocation.getY()));
 }
Example #5
0
  /**
   * This method is used to add obix components to a container pane in the GUI.
   *
   * @param pane The pane, to which the obix Components are added.
   */
  private void addComponentToPane(Container pane) {

    // Create the panel that contains the "cards" for the CardsLayout.
    cards = new JPanel(new CardLayout());
    JScrollPane scrollPane = new JScrollPane(chooseComponents());
    scrollPane.getVerticalScrollBar().setUnitIncrement(16);
    cards.add(scrollPane);

    pane.add(cards, BorderLayout.CENTER);
  }
Example #6
0
  @Override
  public void run() {
    // TODO Auto-generated method stub
    try {
      Socket s = new Socket(hostin, portin);
      InputStream ins = s.getInputStream();
      OutputStream os = s.getOutputStream();
      ir = new BufferedReader(new InputStreamReader(ins));
      pw = new PrintWriter(new OutputStreamWriter(os), true);

      pw.print(nick);
      while (true) {
        String line = ir.readLine();
        jta.append(line + "\n");
        jsp.getVerticalScrollBar().setValue(jsp.getVerticalScrollBar().getMaximum());
      }

    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Example #7
0
  private static void createAndShowGUI() {
    JFrame fr = new JFrame("Test");

    JLabel label = new JLabel("picture");
    label.setPreferredSize(new Dimension(500, 500));
    spane = new JScrollPane(label);
    fr.getContentPane().add(spane);
    sbar = spane.getVerticalScrollBar();

    fr.setSize(200, 200);
    fr.setVisible(true);
  }
 public void setScrollPane(JScrollPane parent) {
   this.parent = parent;
   JScrollBar jsb = parent.getVerticalScrollBar();
   jsb.addAdjustmentListener(
       new AdjustmentListener() {
         @Override
         public void adjustmentValueChanged(AdjustmentEvent ae) {
           if (!ae.getValueIsAdjusting() && autoscroll) {
             jsb.setValue(jsb.getMaximum());
           }
         }
       });
 }
  // populate version for corrections
  public void showCorrectionTokenUpgrades(MapCorrectionAction action) {
    // activate correctionTokenMode and deactivate standard tokenMode
    correctionTokenMode = true;
    tokenMode = false;

    // activate upgrade panel
    upgradePanel.removeAll();
    GridLayout panelLayout = (GridLayout) upgradePanel.getLayout();
    List<? extends TokenI> tokens = orUIManager.tokenLays;

    if (tokens == null || tokens.size() == 0) {
      // reset to the number of elements
      panelLayout.setRows(defaultNbPanelElements);
      // set to position 0
      scrollPane.getVerticalScrollBar().setValue(0);
    } else {
      Color fgColour = null;
      Color bgColour = null;
      String text = null;
      String description = null;
      TokenIcon icon;
      CorrectionTokenLabel tokenLabel;
      correctionTokenLabels = new ArrayList<CorrectionTokenLabel>();
      for (TokenI token : tokens) {
        if (token instanceof BaseToken) {
          PublicCompanyI comp = ((BaseToken) token).getCompany();
          fgColour = comp.getFgColour();
          bgColour = comp.getBgColour();
          description = text = comp.getName();
        }
        icon = new TokenIcon(25, fgColour, bgColour, text);
        tokenLabel = new CorrectionTokenLabel(icon, token);
        tokenLabel.setName(description);
        tokenLabel.setText(description);
        tokenLabel.setBackground(defaultLabelBgColour);
        tokenLabel.setOpaque(true);
        tokenLabel.setVisible(true);
        tokenLabel.setBorder(border);
        tokenLabel.addMouseListener(this);
        tokenLabel.addPossibleAction(action);
        correctionTokenLabels.add(tokenLabel);
        upgradePanel.add(tokenLabel);
      }
    }
    upgradePanel.add(doneButton);
    upgradePanel.add(cancelButton);

    //      repaint();
    revalidate();
  }
  // populate version for corrections
  public void showCorrectionTileUpgrades() {
    // deactivate correctionTokenMode and tokenmode
    correctionTokenMode = false;
    tokenMode = false;

    // activate upgrade panel
    upgradePanel.removeAll();
    GridLayout panelLayout = (GridLayout) upgradePanel.getLayout();
    List<TileI> tiles = orUIManager.tileUpgrades;

    if (tiles == null || tiles.size() == 0) {
      // reset to the number of elements
      panelLayout.setRows(defaultNbPanelElements);
      // set to position 0
      scrollPane.getVerticalScrollBar().setValue(0);
    } else {
      // set to the max of available or the default number of elements
      panelLayout.setRows(Math.max(tiles.size() + 2, defaultNbPanelElements));
      for (TileI tile : tiles) {

        BufferedImage hexImage = getHexImage(tile.getId());
        ImageIcon hexIcon = new ImageIcon(hexImage);

        // Cheap n' Easy rescaling.
        hexIcon.setImage(
            hexIcon
                .getImage()
                .getScaledInstance(
                    (int) (hexIcon.getIconWidth() * GUIHex.NORMAL_SCALE * 0.8),
                    (int) (hexIcon.getIconHeight() * GUIHex.NORMAL_SCALE * 0.8),
                    Image.SCALE_SMOOTH));

        HexLabel hexLabel = new HexLabel(hexIcon, tile.getId());
        hexLabel.setName(tile.getName());
        hexLabel.setTextFromTile(tile);
        hexLabel.setOpaque(true);
        hexLabel.setVisible(true);
        hexLabel.setBorder(border);
        hexLabel.addMouseListener(this);

        upgradePanel.add(hexLabel);
      }
    }

    upgradePanel.add(doneButton);
    upgradePanel.add(cancelButton);

    //      repaint();
    revalidate();
  }
  public void createFileChooserDemo() {
    theImage = new JLabel("");
    jpgIcon = createImageIcon("filechooser/jpgIcon.jpg", "jpg image");
    gifIcon = createImageIcon("filechooser/gifIcon.gif", "gif image");

    JPanel demoPanel = getDemoPanel();
    demoPanel.setLayout(new BoxLayout(demoPanel, BoxLayout.Y_AXIS));

    JPanel innerPanel = new JPanel();
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS));

    demoPanel.add(Box.createRigidArea(VGAP20));
    demoPanel.add(innerPanel);
    demoPanel.add(Box.createRigidArea(VGAP20));

    innerPanel.add(Box.createRigidArea(HGAP20));

    // Create a panel to hold buttons
    JPanel buttonPanel =
        new JPanel() {
          public Dimension getMaximumSize() {
            return new Dimension(getPreferredSize().width, super.getMaximumSize().height);
          }
        };
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));

    buttonPanel.add(Box.createRigidArea(VGAP15));
    buttonPanel.add(createPlainFileChooserButton());
    buttonPanel.add(Box.createRigidArea(VGAP15));
    buttonPanel.add(createPreviewFileChooserButton());
    buttonPanel.add(Box.createRigidArea(VGAP15));
    buttonPanel.add(createCustomFileChooserButton());
    buttonPanel.add(Box.createVerticalGlue());

    // Create a panel to hold the image
    JPanel imagePanel = new JPanel();
    imagePanel.setLayout(new BorderLayout());
    imagePanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
    JScrollPane scroller = new JScrollPane(theImage);
    scroller.getVerticalScrollBar().setUnitIncrement(10);
    scroller.getHorizontalScrollBar().setUnitIncrement(10);
    imagePanel.add(scroller, BorderLayout.CENTER);

    // add buttons and image panels to inner panel
    innerPanel.add(buttonPanel);
    innerPanel.add(Box.createRigidArea(HGAP30));
    innerPanel.add(imagePanel);
    innerPanel.add(Box.createRigidArea(HGAP20));
  }
Example #12
0
 /** Class constructor; creates a user interface and loads it with values from the props file. */
 public ControlPanel() {
   super();
   setLayout(new BorderLayout());
   Configuration config = Configuration.getInstance();
   config.setControlPanel(this);
   props = config.getProperties();
   profiles = new Profiles();
   profileLoader = new ProfileLoader();
   profileSaver = new ProfileSaver();
   profileDeleter = new ProfileDeleter();
   selectorPanel = new SelectorPanel();
   jsp = new JScrollPane();
   jsp.setViewportView(selectorPanel);
   this.add(jsp, BorderLayout.CENTER);
   footerPanel = new FooterPanel();
   this.add(footerPanel, BorderLayout.SOUTH);
   jsp.getVerticalScrollBar().setUnitIncrement(25);
   jsp.getVerticalScrollBar().setBlockIncrement(25);
 }
  @Override
  protected Component createDatabaseDemoPanel() throws SQLException {
    if (_connection == null) {
      return new JPanel();
    }
    final TableModel tableModel = createTableModel();
    final SortableTable table = new SortableTable(tableModel);
    final JScrollPane scroller = new JScrollPane(table);
    scroller
        .getVerticalScrollBar()
        .addAdjustmentListener(
            new AdjustmentListener() {
              public void adjustmentValueChanged(AdjustmentEvent e) {
                table.setCellContentVisible(!e.getValueIsAdjusting());
              }
            });
    scroller.addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentResized(ComponentEvent e) {
            int rowCount = scroller.getViewport().getHeight() / table.getRowHeight();
            PageNavigationSupport pageNavigationSupport =
                (PageNavigationSupport)
                    TableModelWrapperUtils.getActualTableModel(
                        table.getModel(), PageNavigationSupport.class);
            if (pageNavigationSupport != null) {
              pageNavigationSupport.setPageSize(rowCount);
            }
          }
        });

    JPanel demoPanel = new JPanel(new BorderLayout(4, 4));
    demoPanel.add(scroller);
    customizeDemoPanel(table, tableModel, demoPanel);
    return demoPanel;
  }
Example #14
0
  // 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);
  }
  private void displayEntry(
      DXEntry entry, DataBrokerQueryInterface ds, boolean storeOriginalEntry) {
    myEditor.stopCellEditing();

    //        checkedDN = null; // hack - resets promptForSave.
    // Store original Entry for reset
    if (entry != null && storeOriginalEntry && entry.getStatus() == DXEntry.NORMAL)
      originalEntry = new DXEntry(entry);

    // Set the globals...
    currentEntry = entry;
    dataSource = ds;

    if (entry != null && entry.size() == 0) {
      // If there is an entry and its size is zero - it's probably a virtual entry.
      // We need to give the user the option of adding an object class to it i.e. so that
      // it can be added to the directory as a real entry.
      //
      // Disable all the buttons except the 'Change Class' button - but rename this button
      // to 'Add Class' so the user hopefully has a bit more of an idea about what is going on.

      // Sets editor to a blank screen...
      tableData.clear();

      // Disable all buttons except the 'Change Class' button - rename this one...
      submit.setEnabled(false);
      reset.setEnabled(false);
      changeClass.setText(CBIntText.get("Add Class"));
      changeClass.setEnabled(true);
      opAttrs.setEnabled(false);

      virtualEntry = true;

      return;
    }

    virtualEntry = false;

    // Isn't a virtual entry...
    if (entry != null) currentDN = entry.getDN();

    // May have been changed to 'Add Class'...
    changeClass.setText(CBIntText.get("Change Class"));

    // Some quick faffing around, to see if we're coming back from a
    // change classes operation.
    if (classChangedOriginalEntry != null) {
      // If they have the same name, then we're reviewing the same entry - otherwise we've moved on
      if (entry == null || entry.getDN().equals(classChangedOriginalEntry.getDN()) == false)
        classChangedOriginalEntry = null;
    }

    /*
     *    Check that we're not displaying a new entry, and leaving unsaved changes
     *    behind.
     *
     *    This turns out to be quite tricky, and involves a bunch 'o special cases.
     *
     *    First check whether the table data has changed (if not, do nothing)
     *    ->  if the new entry is null, prompt user to save
     *    ->  OR if the DN has changed, and it wasn't due to a rename, prompt user to save
     *
     */
    if (tableData.changedByUser()) // user made changes - were they saved?  (i.e., are we
    { // displaying the result of those changes?)
      boolean prompt = false;

      DXEntry oldEntry = tableData.getOldEntry();

      if (oldEntry != null) {
        /*
         *    The code below is simply checking to see if the name of the
         *    new entry is different from the old entry, and if it is,
         *    whether that's due to the old entry being renamed.
         */
        if (entry == null) {
          prompt = true;
        }
        // TE: added the isEmpty check see bug: 3194.
        else if (!oldEntry.getDN().isEmpty() && entry.getDN().equals(oldEntry.getDN()) == false) {
          DN oldParent = oldEntry.getDN().getParent();

          DN newParent = entry.getDN().getParent();

          if (oldParent.equals(newParent) == false) {
            prompt = true;
          } else {
            if (entry.getDN().getLowestRDN().equals(tableData.getRDN()) == false) {
              prompt = true;
            }
          }
        }

        if (prompt) // yes, there is a risk of data loss - prompt the user.
        {
          checkForUnsavedChanges(); // see if the user wants to save their data
        }
      }
    }

    myEditor.setDataSource(
        ds); // Sets the DataBrokerQueryInterface in AttributeValueCellEditor used to get the syntax
             // of attributes.

    // only enable buttons if DataBrokerQueryInterface
    // is valid *and* we can modify data...

    if (dataSource == null || entry == null || dataSource.isModifiable() == false) {
      setReadWrite(false, entry);
    } else {
      setReadWrite(true, entry);
    }

    //        myEditor.stopCellEditing();

    if (entry != null) {
      entry.expandAllAttributes();
      currentDN = entry.getDN();

      tableData.insertAttributes(entry);
      popupTableTool.setDN(currentDN); // Sets the DN in SmartPopupTableTool.
      myEditor.setDN(
          currentDN); // Sets the DN in the attributeValueCellEditor which can be used to identify
                      // the entry that is being modified/
    } else {
      tableData.clear(); // Sets editor to a blank screen.
    }

    tableScroller.getVerticalScrollBar().setValue(0); // Sets the scroll bar back to the top.
  }
  public void installComponents(JFileChooser fc) {
    fc.setLayout(new BorderLayout(10, 10));
    fc.setAlignmentX(JComponent.CENTER_ALIGNMENT);

    JPanel interior =
        new JPanel() {
          public Insets getInsets() {
            return insets;
          }
        };
    align(interior);
    interior.setLayout(new BoxLayout(interior, BoxLayout.PAGE_AXIS));

    fc.add(interior, BorderLayout.CENTER);

    // PENDING(jeff) - I18N
    JLabel l = new JLabel(pathLabelText);
    l.setDisplayedMnemonic(pathLabelMnemonic);
    align(l);
    interior.add(l);

    File currentDirectory = fc.getCurrentDirectory();
    String curDirName = null;
    if (currentDirectory != null) {
      curDirName = currentDirectory.getPath();
    }
    pathField =
        new JTextField(curDirName) {
          public Dimension getMaximumSize() {
            Dimension d = super.getMaximumSize();
            d.height = getPreferredSize().height;
            return d;
          }
        };
    l.setLabelFor(pathField);
    align(pathField);

    // Change to folder on return
    pathField.addActionListener(getUpdateAction());
    interior.add(pathField);

    interior.add(Box.createRigidArea(vstrut10));

    // CENTER: left, right accessory
    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.LINE_AXIS));
    align(centerPanel);

    // left panel - Filter & folderList
    JPanel leftPanel = new JPanel();
    leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.PAGE_AXIS));
    align(leftPanel);

    // add the filter PENDING(jeff) - I18N
    l = new JLabel(filterLabelText);
    l.setDisplayedMnemonic(filterLabelMnemonic);
    align(l);
    leftPanel.add(l);

    filterComboBox =
        new JComboBox() {
          public Dimension getMaximumSize() {
            Dimension d = super.getMaximumSize();
            d.height = getPreferredSize().height;
            return d;
          }
        };
    l.setLabelFor(filterComboBox);
    filterComboBoxModel = createFilterComboBoxModel();
    filterComboBox.setModel(filterComboBoxModel);
    filterComboBox.setRenderer(createFilterComboBoxRenderer());
    fc.addPropertyChangeListener(filterComboBoxModel);
    align(filterComboBox);
    leftPanel.add(filterComboBox);

    // leftPanel.add(Box.createRigidArea(vstrut10));

    // Add the Folder List PENDING(jeff) - I18N
    l = new JLabel(foldersLabelText);
    l.setDisplayedMnemonic(foldersLabelMnemonic);
    align(l);
    leftPanel.add(l);
    JScrollPane sp = createDirectoryList();
    sp.getVerticalScrollBar().setFocusable(false);
    sp.getHorizontalScrollBar().setFocusable(false);
    l.setLabelFor(sp.getViewport().getView());
    leftPanel.add(sp);

    // create files list
    JPanel rightPanel = new JPanel();
    align(rightPanel);
    rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.PAGE_AXIS));

    l = new JLabel(filesLabelText);
    l.setDisplayedMnemonic(filesLabelMnemonic);
    align(l);
    rightPanel.add(l);
    sp = createFilesList();
    l.setLabelFor(sp);
    rightPanel.add(sp);

    centerPanel.add(leftPanel);
    centerPanel.add(Box.createRigidArea(hstrut10));
    centerPanel.add(rightPanel);

    JComponent accessoryPanel = getAccessoryPanel();
    JComponent accessory = fc.getAccessory();
    if (accessoryPanel != null) {
      if (accessory == null) {
        accessoryPanel.setPreferredSize(ZERO_ACC_SIZE);
        accessoryPanel.setMaximumSize(ZERO_ACC_SIZE);
      } else {
        getAccessoryPanel().add(accessory, BorderLayout.CENTER);
        accessoryPanel.setPreferredSize(PREF_ACC_SIZE);
        accessoryPanel.setMaximumSize(MAX_SIZE);
      }
      align(accessoryPanel);
      centerPanel.add(accessoryPanel);
    }
    interior.add(centerPanel);
    interior.add(Box.createRigidArea(vstrut10));

    // add the filename field PENDING(jeff) - I18N
    l = new JLabel(enterFileNameLabelText);
    l.setDisplayedMnemonic(enterFileNameLabelMnemonic);
    align(l);
    interior.add(l);

    filenameTextField =
        new JTextField() {
          public Dimension getMaximumSize() {
            Dimension d = super.getMaximumSize();
            d.height = getPreferredSize().height;
            return d;
          }
        };
    l.setLabelFor(filenameTextField);
    filenameTextField.addActionListener(getApproveSelectionAction());
    align(filenameTextField);
    filenameTextField.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    interior.add(filenameTextField);

    bottomPanel = getBottomPanel();
    bottomPanel.add(new JSeparator(), BorderLayout.NORTH);

    // Add buttons
    JPanel buttonPanel = new JPanel();
    align(buttonPanel);
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
    buttonPanel.add(Box.createGlue());

    approveButton =
        new JButton(getApproveButtonText(fc)) {
          public Dimension getMaximumSize() {
            return new Dimension(MAX_SIZE.width, this.getPreferredSize().height);
          }
        };
    approveButton.setMnemonic(getApproveButtonMnemonic(fc));
    approveButton.setToolTipText(getApproveButtonToolTipText(fc));
    align(approveButton);
    approveButton.setMargin(buttonMargin);
    approveButton.addActionListener(getApproveSelectionAction());
    buttonPanel.add(approveButton);
    buttonPanel.add(Box.createGlue());

    JButton updateButton =
        new JButton(updateButtonText) {
          public Dimension getMaximumSize() {
            return new Dimension(MAX_SIZE.width, this.getPreferredSize().height);
          }
        };
    updateButton.setMnemonic(updateButtonMnemonic);
    updateButton.setToolTipText(updateButtonToolTipText);
    align(updateButton);
    updateButton.setMargin(buttonMargin);
    updateButton.addActionListener(getUpdateAction());
    buttonPanel.add(updateButton);
    buttonPanel.add(Box.createGlue());

    JButton cancelButton =
        new JButton(cancelButtonText) {
          public Dimension getMaximumSize() {
            return new Dimension(MAX_SIZE.width, this.getPreferredSize().height);
          }
        };
    cancelButton.setMnemonic(cancelButtonMnemonic);
    cancelButton.setToolTipText(cancelButtonToolTipText);
    align(cancelButton);
    cancelButton.setMargin(buttonMargin);
    cancelButton.addActionListener(getCancelSelectionAction());
    buttonPanel.add(cancelButton);
    buttonPanel.add(Box.createGlue());

    JButton helpButton =
        new JButton(helpButtonText) {
          public Dimension getMaximumSize() {
            return new Dimension(MAX_SIZE.width, this.getPreferredSize().height);
          }
        };
    helpButton.setMnemonic(helpButtonMnemonic);
    helpButton.setToolTipText(helpButtonToolTipText);
    align(helpButton);
    helpButton.setMargin(buttonMargin);
    helpButton.setEnabled(false);
    buttonPanel.add(helpButton);
    buttonPanel.add(Box.createGlue());

    bottomPanel.add(buttonPanel, BorderLayout.SOUTH);
    if (fc.getControlButtonsAreShown()) {
      fc.add(bottomPanel, BorderLayout.SOUTH);
    }
  }
  /**
   * Create a new FeatureListFrame component. The constructor does not call setVisible (true).
   *
   * @param title The title to use for the new JFrame.
   * @param feature_list The FeatureList to show.
   * @param selection The Selection that the commands in the menus will operate on.
   * @param entry_group The EntryGroup object where new features/entries will be added.
   * @param goto_event_source The object that the menu item will call makeBaseVisible() on.
   */
  public FeatureListFrame(
      final String title,
      final Selection selection,
      final GotoEventSource goto_event_source,
      final EntryGroup entry_group,
      final BasePlotGroup base_plot_group) {
    super(title);

    this.entry_group = entry_group;

    feature_list = new FeatureList(entry_group, selection, goto_event_source, base_plot_group);

    final Font default_font = Options.getOptions().getFont();
    setFont(default_font);

    final JMenuBar menu_bar = new JMenuBar();
    menu_bar.setFont(default_font);
    setJMenuBar(menu_bar);

    final JMenu file_menu = new JMenu("File");
    final JMenuItem close = new JMenuItem("Close");
    close.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            setVisible(false);
            FeatureListFrame.this.dispose();
            feature_list.stopListening();
          }
        });

    file_menu.add(close);
    menu_bar.add(file_menu);

    final JMenu select_menu =
        new SelectMenu(this, selection, goto_event_source, entry_group, base_plot_group);
    menu_bar.add(select_menu);

    final JMenu view_menu =
        new ViewMenu(this, selection, goto_event_source, entry_group, base_plot_group);
    menu_bar.add(view_menu);

    final JMenu goto_menu = new GotoMenu(this, selection, goto_event_source, entry_group);
    menu_bar.add(goto_menu);

    if (Options.readWritePossible()) {
      final JMenu edit_menu =
          new EditMenu(this, selection, goto_event_source, entry_group, base_plot_group, null);
      menu_bar.add(edit_menu);

      final JMenu write_menu = new WriteMenu(this, selection, entry_group);
      menu_bar.add(write_menu);

      final JMenu run_menu = new RunMenu(this, selection);
      menu_bar.add(run_menu);
    }

    final JScrollPane jsp_feature_list = new JScrollPane(feature_list);
    getContentPane().add(jsp_feature_list, "Center");

    final JPanel panel = new JPanel();

    final JButton close_button = new JButton("Close");

    panel.add(close_button);
    close_button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setVisible(false);
            FeatureListFrame.this.dispose();
            feature_list.stopListening();
          }
        });

    getContentPane().add(panel, "South");
    pack();

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent event) {
            setVisible(false);
            entry_group.removeEntryGroupChangeListener(FeatureListFrame.this);
            FeatureListFrame.this.dispose();
            feature_list.stopListening();
          }
        });

    entry_group.addEntryGroupChangeListener(this);

    final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();

    int screen_height = screen.height;
    int screen_width = screen.width;

    if (screen_width <= 700 || screen_height <= 400)
      setSize(screen_width * 9 / 10, screen_height * 9 / 10);
    else setSize(700, 400);

    final int hgt = entry_group.getAllFeaturesCount() * feature_list.getLineHeight();
    feature_list.setPreferredSize(new Dimension(getSize().width * 4, hgt));
    jsp_feature_list.getVerticalScrollBar().setUnitIncrement(feature_list.getLineHeight());

    setLocation(
        new Point((screen.width - getSize().width) / 2, (screen.height - getSize().height) / 2));
  }
Example #18
0
  public Reflexology2() {
    frame.setSize(615, 455);
    frame.setLocationRelativeTo(null);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setTitle("Reflexology 2.0");
    frame.setResizable(false);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    ListenFor2Button lFor2Button = new ListenFor2Button();
    ListenFor3Button lFor3Button = new ListenFor3Button();
    ListenFor4Button lFor4Button = new ListenFor4Button();
    ListenFor5Button lFor5Button = new ListenFor5Button();
    btnPage2.addActionListener(lFor2Button);
    btnPage3.addActionListener(lFor3Button);
    btnPage4.addActionListener(lFor4Button);
    btnDone.addActionListener(lFor5Button);
  }
  @SuppressWarnings("serial")
  public JTableRenderer(final Object cell, final GraphComponent graphContainer) {
    this.cell = cell;
    this.graphContainer = graphContainer;
    this.graph = graphContainer.getGraph();
    setLayout(new BorderLayout());
    setBorder(
        BorderFactory.createCompoundBorder(
            ShadowBorder.getSharedInstance(), BorderFactory.createBevelBorder(BevelBorder.RAISED)));

    JPanel title = new JPanel();
    title.setBackground(new Color(149, 173, 239));
    title.setOpaque(true);
    title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1));
    title.setLayout(new BorderLayout());

    JLabel icon =
        new JLabel(new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "preferences.gif")));
    icon.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 1));
    title.add(icon, BorderLayout.WEST);

    JLabel label = new JLabel(String.valueOf(graph.getLabel(cell)));
    label.setForeground(Color.WHITE);
    label.setFont(title.getFont().deriveFont(Font.BOLD, 11));
    label.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 2));
    title.add(label, BorderLayout.CENTER);

    JPanel toolBar2 = new JPanel();
    toolBar2.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 2));
    toolBar2.setOpaque(false);
    JButton button =
        new JButton(
            new AbstractAction(
                "", new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "minimize.gif"))) {

              public void actionPerformed(ActionEvent e) {
                graph.foldCells(graph.isCellCollapsed(cell), false, new Object[] {cell});
                ((JButton) e.getSource())
                    .setIcon(
                        new ImageIcon(
                            JTableRenderer.class.getResource(
                                IMAGE_PATH
                                    + ((graph.isCellCollapsed(cell))
                                        ? "maximize.gif"
                                        : "minimize.gif"))));
              }
            });
    button.setPreferredSize(new Dimension(16, 16));
    button.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    button.setToolTipText("Collapse/Expand");
    button.setOpaque(false);
    toolBar2.add(button);

    title.add(toolBar2, BorderLayout.EAST);
    add(title, BorderLayout.NORTH);

    // CellStyle style =
    // graph.getStylesheet().getCellStyle(graph.getModel(),
    // cell);
    // if (style.getStyleClass() == null) {
    table = new MyTable();
    JScrollPane scrollPane = new JScrollPane(table);
    scrollPane.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

    if (graph.getModel().getChildCount(cell) == 0) {
      scrollPane.getViewport().setBackground(Color.WHITE);
      setOpaque(true);
      add(scrollPane, BorderLayout.CENTER);
    }

    scrollPane
        .getVerticalScrollBar()
        .addAdjustmentListener(
            new AdjustmentListener() {

              public void adjustmentValueChanged(AdjustmentEvent e) {
                graphContainer.refresh();
              }
            });

    label = new JLabel(new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "resize.gif")));
    label.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR));

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(label, BorderLayout.EAST);

    add(panel, BorderLayout.SOUTH);

    ResizeHandler resizeHandler = new ResizeHandler();
    label.addMouseListener(resizeHandler);
    label.addMouseMotionListener(resizeHandler);

    setMinimumSize(new Dimension(20, 30));
  }