public void setColor(Color _color) {
   myColor = _color;
   tabbedPanel.setForeground(_color);
   firstButton.setForeground(_color);
   for (java.util.Enumeration<Editor> e = pageList.elements(); e.hasMoreElements(); )
     e.nextElement().setColor(_color);
 }
  // private JPanel jpan
  public GuiMainApp(Properties properties) {
    pres = new PresentorApp(this);
    pres.initLudotheque(properties);

    btn.setVisible(true);
    btn.addActionListener(pres);

    this.setLayout(new BorderLayout());
    p.setLayout(new BorderLayout());
    p.setVisible(false);
    p.add(btn, BorderLayout.EAST);

    btnModif.setVisible(true);
    btnModif.addActionListener(pres);

    p.add(btnModif, BorderLayout.WEST);
    add(p, BorderLayout.NORTH);
    tabbedpane.setTabPlacement(JTabbedPane.TOP);
    tabbedpane.setForeground(Color.BLUE);

    add(tabbedpane, BorderLayout.CENTER);
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.getContentPane().setBackground(Color.WHITE);
    frame.getContentPane().setForeground(Color.RED);
    frame.setBackground(Color.WHITE);
    frame.setBounds(100, 100, 613, 459);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

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

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

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

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

    // panel_1.add(textPane_1);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public void run() {

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

      public void main(String args[]) {
        (new Inner()).start();
      }
    }
    Inner reloads = new Inner();
    reloads.start();
  }
  /** Create the panel. */
  public ArtistInfoPanel(final ArtistNode a) {
    super();
    NumberFormat nf1 = NumberFormat.getInstance();

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

    // COMPONENTS

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

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

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

    // Name panel / Scrobble label

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

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

    // Name panel / Name label

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

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

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

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

    // content panel / biography panel

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

    // content panel / biography panel / biography TextArea

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

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

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

    // content panel / popular content panel

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

    // content panel / popular content panel / container panel

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

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

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

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

    container.add(tracksPanel, BorderLayout.CENTER);

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

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

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

    container.add(albumsPanel, BorderLayout.SOUTH);

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

    // content panel / blogpost panel

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

    // content panel / blogpost panel / posts list

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

    postPanel.getViewport().setView(list);

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

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

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

    // west panel / image panel

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

    panel.add(imagePanel, BorderLayout.CENTER);

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

    // west panel / image panel / textfield

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

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

    tagsPanel.add(tagField);

    panel.add(tagsPanel, BorderLayout.SOUTH);

    this.add(panel, BorderLayout.WEST);

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

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

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

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

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

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

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

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

    buttonsPanel.setBackground(Color.DARK_GRAY);

    musicPanel.add(buttonsPanel);

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

    // =========================================================================================
  }
Beispiel #5
0
  public static void createTabItem(ActionContext actionContext) {
    Thing self = (Thing) actionContext.get("self");
    JTabbedPane parent = (JTabbedPane) actionContext.get("parent");

    Thing thing = self.getThing("Component@0");
    if (thing != null) {
      try {
        Bindings bindings = actionContext.push();
        bindings.put("parent", null);

        for (Thing child : thing.getChilds()) {
          Component c = (Component) child.doAction("create", actionContext);
          if (c != null) {
            int index = parent.getTabCount();
            parent.setComponentAt(index, c);

            Color background = AwtCreator.createColor(thing, "background", actionContext);
            if (background != null) {
              parent.setBackgroundAt(index, background);
            }

            Icon disabledIcon = SwingCreator.createIcon(thing, "disabledIcon", actionContext);
            if (disabledIcon != null) {
              parent.setDisabledIconAt(index, disabledIcon);
            }

            Integer displayedMnemonicIndex =
                JavaCreator.createInteger(thing, "displayedMnemonicIndex");
            if (displayedMnemonicIndex != null) {
              parent.setDisplayedMnemonicIndexAt(index, displayedMnemonicIndex);
            }

            Boolean enabled = JavaCreator.createBoolean(thing, "enabled");
            if (enabled != null) {
              parent.setEnabledAt(index, enabled);
            }

            Color foreground = AwtCreator.createColor(thing, "foreground", actionContext);
            if (foreground != null) {
              parent.setForeground(foreground);
            }

            Icon icon = SwingCreator.createIcon(thing, "icon", actionContext);
            if (icon != null) {
              parent.setIconAt(index, icon);
            }

            Integer mnemonic = AwtCreator.createMnemonic(thing, "mnemonic");
            if (mnemonic != null) {
              parent.setMnemonicAt(index, mnemonic);
            }

            Boolean selected = JavaCreator.createBoolean(thing, "selected");
            if (selected != null && selected) {
              parent.setSelectedIndex(index);
            }

            String title = JavaCreator.createText(thing, "title", actionContext);
            if (title != null) {
              parent.setTitleAt(index, title);
            }

            String toolTipText = JavaCreator.createText(thing, "toolTipText", actionContext);
            if (toolTipText != null) {
              parent.setToolTipTextAt(index, toolTipText);
            }
            break;
          }
        }
      } finally {
        actionContext.pop();
      }
    }
  }
Beispiel #6
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frmElasticoElektronische = new JFrame();
    frmElasticoElektronische.setLocation(new Point(200, 100));
    frmElasticoElektronische.setResizable(false);
    frmElasticoElektronische.setTitle(
        "Elastico - Elektronische Arbeitsschritt / Information / Control / Observation");
    frmElasticoElektronische.setBackground(Color.WHITE);
    frmElasticoElektronische.getContentPane().setBackground(Color.WHITE);
    frmElasticoElektronische.setIconImage(
        Toolkit.getDefaultToolkit()
            .getImage(Hauptseite.class.getResource("/gui/images/LogoFinal.png")));
    frmElasticoElektronische.setBounds(100, 100, 801, 400);
    frmElasticoElektronische.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frmElasticoElektronische.getContentPane().setLayout(null);

    // Hier erzeugen wir unsere JPanels
    JPanel panelMenu = new JPanel();
    JPanel panelStricheln = new JPanel();
    JPanel panelStatistik = new JPanel();
    JPanel panelAdministration = new JPanel();

    // Hier setzen wir die Hintergrundfarben fŸr die JPanels
    panelMenu.setBackground(Color.WHITE);
    panelStricheln.setBackground(Color.WHITE);
    panelStatistik.setBackground(Color.WHITE);
    panelAdministration.setBackground(Color.WHITE);

    // Erzeugung eines JTabbedPane-Objektes
    JTabbedPane tabpane = new JTabbedPane(JTabbedPane.TOP);
    tabpane.setForeground(Color.BLACK);
    tabpane.setBackground(Color.WHITE);
    tabpane.setBounds(23, 6, 754, 325);

    // Hier werden die JPanels als Registerkarten hinzugefŸgt
    tabpane.addTab("MenŸ", panelMenu);
    panelMenu.setLayout(null);

    tabpane.addTab("Startseite", panelMenu);
    tabpane.addTab("Stricheln", panelMenu);

    // TODO Stricheln Oberflaeche einbinden
    JLabel lblTodo = new JLabel("TODO");
    lblTodo.setBounds(71, 26, 61, 16);
    panelMenu.add(lblTodo);
    tabpane.addTab("Statistik", panelStatistik);
    panelStatistik.setLayout(null);

    // TODO Statistik Oberflaeche einbinden
    JLabel lblTodo_1 = new JLabel("TODO");
    lblTodo_1.setBounds(64, 70, 61, 16);
    panelStatistik.add(lblTodo_1);
    tabpane.addTab("Administration", panelAdministration);
    panelAdministration.setLayout(null);

    JLabel lblBenutzerverwaltung = new JLabel("Benutzerverwaltung:");
    lblBenutzerverwaltung.setBounds(6, 6, 127, 16);
    panelAdministration.add(lblBenutzerverwaltung);

    JLabel lblOrganisationseinheitenverwaltung = new JLabel("Organisationseinheitenverwaltung:");
    lblOrganisationseinheitenverwaltung.setBounds(6, 97, 252, 16);
    panelAdministration.add(lblOrganisationseinheitenverwaltung);

    JLabel lblSystemverwaltung = new JLabel("Systemverwaltung:");
    lblSystemverwaltung.setBounds(6, 183, 175, 16);
    panelAdministration.add(lblSystemverwaltung);

    JButton btnNeuerBenutzer = new JButton("Benutzer anlegen");
    btnNeuerBenutzer.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            NeuerBenutzer NeuerBenutzer = new NeuerBenutzer();
            NeuerBenutzer.setVisible(true);
          }
        });
    btnNeuerBenutzer.setBounds(6, 34, 137, 40);
    panelAdministration.add(btnNeuerBenutzer);

    JButton btnBenutzerBearbeiten = new JButton("Benutzer bearbeiten");
    btnBenutzerBearbeiten.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            BearbeitungBenutzer BearbeitungBenutzer = new BearbeitungBenutzer();
            BearbeitungBenutzer.setVisible(true);
          }
        });
    btnBenutzerBearbeiten.setBounds(155, 34, 144, 40);
    panelAdministration.add(btnBenutzerBearbeiten);

    JButton btnBenutzerLschen = new JButton("Benutzer l\u00F6schen");
    btnBenutzerLschen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            LoescheBenutzer LoescheBenutzer = new LoescheBenutzer();
            LoescheBenutzer.setVisible(true);
          }
        });
    btnBenutzerLschen.setBounds(311, 34, 127, 40);
    panelAdministration.add(btnBenutzerLschen);

    JButton btnNeueOrganisationseinheit = new JButton("Organisationseinheit anlegen");
    btnNeueOrganisationseinheit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            NeueOrgaEinheit NeueOrgaEinheit = new NeueOrgaEinheit();
            NeueOrgaEinheit.setVisible(true);
          }
        });
    btnNeueOrganisationseinheit.setBounds(6, 125, 208, 40);
    panelAdministration.add(btnNeueOrganisationseinheit);

    JButton btnOrgaeinheitInaktivSetzen = new JButton("Organisationseinheit Inaktiv setzen");
    btnOrgaeinheitInaktivSetzen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            OrgaEinheitInaktiv OrgaEinheitInaktiv = new OrgaEinheitInaktiv();
            OrgaEinheitInaktiv.setVisible(true);
          }
        });
    btnOrgaeinheitInaktivSetzen.setBounds(226, 125, 236, 40);
    panelAdministration.add(btnOrgaeinheitInaktivSetzen);

    JButton button = new JButton("?");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Administrationshilfe Administrationshilfe = new Administrationshilfe();
            Administrationshilfe.setVisible(true);
          }
        });
    button.setBounds(698, 244, 29, 29);
    panelAdministration.add(button);

    JButton btnStrichkategorienHinzufgen = new JButton("Strichkategorien anlegen");
    btnStrichkategorienHinzufgen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            NeueStrichkategorie StrichkategorieHinzu = new NeueStrichkategorie();
            StrichkategorieHinzu.setVisible(true);
          }
        });
    btnStrichkategorienHinzufgen.setBounds(6, 211, 180, 40);
    panelAdministration.add(btnStrichkategorienHinzufgen);

    JButton btnOrganisationseinheitWechseln = new JButton("Organisationseinheit wechseln");
    btnOrganisationseinheitWechseln.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            BearbeitungBenutzerOrgaEinheit BearbeitungBenutzerOrgaEinheit =
                new BearbeitungBenutzerOrgaEinheit();
            BearbeitungBenutzerOrgaEinheit.setVisible(true);
          }
        });
    btnOrganisationseinheitWechseln.setBounds(448, 34, 216, 40);
    panelAdministration.add(btnOrganisationseinheitWechseln);

    // JTabbedPane wird unserem Dialog hinzugefŸgt
    frmElasticoElektronische.getContentPane().add(tabpane);

    JButton btnNewButton_2 = new JButton("Beenden");
    btnNewButton_2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            AnwendungAbbruch frmAnwendungAbbruch = new AnwendungAbbruch();
            frmAnwendungAbbruch.setVisible(true);
          }
        });
    btnNewButton_2.setBounds(660, 332, 117, 29);
    frmElasticoElektronische.getContentPane().add(btnNewButton_2);

    JButton btnNewButton_1 = new JButton("?");
    btnNewButton_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            HauptseiteHilfe frmHauptmenueHilfe = new HauptseiteHilfe();
            frmHauptmenueHilfe.setVisible(true);
          }
        });
    btnNewButton_1.setBounds(33, 332, 29, 29);
    frmElasticoElektronische.getContentPane().add(btnNewButton_1);

    // TODO Aktion einbinden, sodass der hinter dem benutzernamen stehende Name mit Vor- und
    // Nachname angezeigt wird.
    JLabel lblEingeloggtAlsJanis = new JLabel("Eingeloggt als: Janis H\u00F6pken");
    lblEingeloggtAlsJanis.setBounds(74, 337, 180, 16);
    frmElasticoElektronische.getContentPane().add(lblEingeloggtAlsJanis);
  }
  public TeacherPanel(int index) {
    super("Teacher's Index");
    final JTabbedPane tabStudent = new JTabbedPane();
    JPanel pnlAdd = new JPanel();
    JPanel pnlList = new JPanel();

    Font font = new Font("Comic Sans MS", Font.PLAIN, 13);

    JPanel addRest = new JPanel();
    addRest.setLayout(new GridLayout(1, 2, 10, 0));
    addRest.setBorder(BorderFactory.createEmptyBorder(0, 100, 10, 420));
    btnAdd = new JButton("Add");
    btnAdd.setPreferredSize(new Dimension(90, 35));
    ActionListener addhdl = new addHadler();
    btnAdd.addActionListener(addhdl);

    resetHandler resetHdl = new resetHandler();
    btnReset = new JButton("Reset");
    btnReset.addActionListener(resetHdl);
    addRest.add(btnAdd);
    addRest.add(btnReset);

    JPanel exitPanel = new JPanel();
    exitPanel.setLayout(new GridLayout(1, 3, 10, 0));
    exitPanel.setBorder(BorderFactory.createEmptyBorder(10, 500, 10, 10));

    btnDash = new JButton("Dashboard");
    btnDash.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            dispose();
            @SuppressWarnings("unused")
            MainPanel mainPanel = new MainPanel();
          }
        });

    btnLogout = new JButton("Logout");
    btnLogout.addActionListener(
        new ActionListener() {
          @SuppressWarnings("unused")
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            dispose();
            Login lgn = new Login();
          }
        });

    btnExit = new JButton("Exit");
    btnExit.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            System.exit(0);
          }
        });
    exitPanel.add(btnDash);
    exitPanel.add(btnLogout);
    exitPanel.add(btnExit);

    // String tabStudentTitle = "Add Student";
    JPanel stdn = new JPanel();
    stdn.setLayout(new BorderLayout());
    stdn.add(addRest, BorderLayout.CENTER);
    stdn.add(this.addStduentPanel(), BorderLayout.NORTH);

    pnlAdd = stdn;

    JPanel listEdit = new JPanel();
    listEdit.setLayout(new BorderLayout());
    listEdit.add(this.listStudentPanel(), BorderLayout.NORTH);
    listEdit.add(this.editDelete(), BorderLayout.CENTER);

    pnlList.setLayout(new FlowLayout());
    pnlList.add(listEdit);

    tabStudent.addTab("Add Teacher", new ImageIcon("img/add.png"), pnlAdd);
    tabStudent.addTab("List Teachers", new ImageIcon("img/list.png"), pnlList);

    tabStudent.setSelectedIndex(index);
    tabStudent.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    tabStudent.setForeground(Color.BLUE);
    tabStudent.setFont(font);

    JPanel AllGui = new JPanel();
    AllGui.setLayout(new BorderLayout());
    AllGui.add(tabStudent, BorderLayout.NORTH);
    AllGui.add(exitPanel, BorderLayout.CENTER);

    this.pack();
    this.setContentPane(AllGui);
    this.setSize(800, 500);
    this.setResizable(false);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setVisible(true);
  }