예제 #1
0
  private void layoutBottomRightPart(JSplitPane rightSplitPanel) {
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    rightSplitPanel.setBottomComponent(tabbedPane);

    tabbedPane.addTab("Images", null, mImageListPanel, null);
  }
예제 #2
0
  public MainPanel() {
    super(new BorderLayout());
    vcheck.setSelected(true);
    echeck.setSelected(true);
    tcheck.setSelected(true);

    JTabbedPane tab = new JTabbedPane();
    tab.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    button.addHierarchyListener(
        new HierarchyListener() {
          @Override
          public void hierarchyChanged(HierarchyEvent e) {
            if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
              printInfo("SHOWING_CHANGED");
            }
            if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
              printInfo("DISPLAYABILITY_CHANGED");
            }
          }
        });

    printInfo("after: new JButton, before: add(button); frame.setVisible(true)");

    JPanel panel = new JPanel();
    panel.add(button);
    for (int i = 0; i < 5; i++) {
      panel.add(new JLabel("<html>asfasfdasdfasdfsa<br>asfdd134123fgh"));
    }
    tab.addTab("Main", new JScrollPane(panel));
    tab.addTab("JTree", new JScrollPane(new JTree()));
    tab.addTab("JLabel", new JLabel("Test"));

    JPanel p1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    p1.add(new JLabel("JButton:"));
    p1.add(vcheck);
    p1.add(echeck);
    JPanel p2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    p2.add(new JLabel("Timer:"));
    p2.add(tcheck);

    JPanel p = new JPanel(new GridLayout(2, 1));
    p.add(p1);
    p.add(p2);
    add(p, BorderLayout.NORTH);
    add(tab);
    timer =
        new Timer(
            4000,
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                printInfo(new Date().toString());
              }
            });
    timer.start();
    setPreferredSize(new Dimension(320, 240));
  }
예제 #3
0
  // Handle the menu item action events
  public void actionPerformed(ActionEvent ae) {
    String s = ae.getActionCommand();

    if (s.equals("Exit")) {
      System.exit(0);
    }

    if (s.equals("About")) {
      joptionpane.showMessageDialog(frame, "Rolodex version 0.1\n(c) 2014 Jong Woo Lee");
    }

    if (s.equals("Left")) {
      jtp.setTabPlacement(JTabbedPane.LEFT);
    }

    if (s.equals("Top")) {
      jtp.setTabPlacement(JTabbedPane.TOP);
    }

    if (s.equals("Bottom")) {
      jtp.setTabPlacement(JTabbedPane.BOTTOM);
    }

    if (s.equals("Right")) {
      jtp.setTabPlacement(JTabbedPane.RIGHT);
    }

    if (s.equals("Defaults")) {
      jtp.setTabPlacement(JTabbedPane.TOP);
    }

    if (s.equals("Scroll")) {
      jtp.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    }

    if (s.equals("Wrap")) {
      jtp.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT);
    }
  }
예제 #4
0
  private static void createAndShowUI() {
    frame = new JFrame("bug7170310");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 100);

    tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Main Tab", new JPanel());

    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

    frame.getContentPane().add(tabbedPane);
    frame.setVisible(true);
  }
예제 #5
0
  public CityTabbedPane() {
    super(new GridLayout(1, 1));

    tabbedPane = new JTabbedPane();
    add(tabbedPane);

    setPreferredSize(new Dimension(200, 860));
    // animation.setMaximumSize(new Dimension(800, 800));
    setMinimumSize(new Dimension(200, 860));

    // The following line enables to use scrolling tabs.
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
  }
  public TabbedEditor(org.colos.ejs.osejs.Osejs _ejs, String _type, String _header) {
    ejs = _ejs;
    defaultType = _type;
    defaultHeader = _header;
    defaultString = new String(res.getString(defaultHeader + ".Page"));

    MyActionListener al = new MyActionListener();

    popupMenu = new PopupMenu();
    customMenuItems(al); // Creates the top menu items
    // common menu items
    copyPage = createMenuItem("copyPage", defaultHeader, al);
    upPage = createMenuItem("upPage", defaultHeader, al);
    dnPage = createMenuItem("dnPage", defaultHeader, al);
    renamePage = createMenuItem("renamePage", defaultHeader, al);
    popupMenu.addSeparator();
    togglePage = createMenuItem("togglePage", defaultHeader, al);
    removePage = createMenuItem("removePage", defaultHeader, al);

    JPanel firstPanel = createFirstPanel();

    tabbedPanel = new JTabbedPane();
    tabbedPanel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    tabbedPanel.add(popupMenu);
    // tabbedPanel.setPreferredSize (res.getDimension("TabbedEditor.PreferredSize"));
    tabbedPanel.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mousePressed(java.awt.event.MouseEvent evt) {
            if (OSPRuntime.isPopupTrigger(evt)) // SwingUtilities.isRightMouseButton(evt))
            showMenu(evt.getComponent(), evt.getX(), evt.getY());
          }
        });
    cardLayout = new CardLayout();
    finalPanel = new JPanel(cardLayout);
    finalPanel.add(tabbedPanel, "TabbedPanel");
    finalPanel.add(firstPanel, "FirstPanel");
    setFont(finalPanel.getFont());

    Font font = InterfaceUtils.font(null, res.getString("Editor.TitleFont"));
    addPageMI.setFont(font);
    copyPage.setFont(font);
    upPage.setFont(font);
    dnPage.setFont(font);
    togglePage.setFont(font);
    removePage.setFont(font);
    renamePage.setFont(font);
    myFont = font.deriveFont(Font.PLAIN);
    showFirstPage();
  }
  private void addControls() {
    this.setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));
    panelMenu = new PanelMenu();
    panelMenu.setBorder(new EmptyBorder(5, 5, 5, 5));
    panelMenu.setPreferredSize(new Dimension(410, 50));
    add(panelMenu);

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    ImageIcon icon = createImageIcon("exam.jpg");

    panelExam = new PanelExam();
    tabbedPane.addTab(getText("Exams"), icon, panelExam, getText("Manage.exams"));
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

    icon = createImageIcon("question.png");
    panelQuestion = new PanelQuestion();
    tabbedPane.addTab(getText("Questions"), icon, panelQuestion, getText("Manage.questions"));
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

    icon = createImageIcon("exclamation.png");
    panelAnswer = new PanelAnswer();
    tabbedPane.addTab(getText("Answers"), icon, panelAnswer, getText("Manage.answers"));
    panelAnswer.setPreferredSize(new Dimension(410, 50));
    tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

    tabbedPane.addChangeListener(
        new ChangeListener() {

          @Override
          public void stateChanged(ChangeEvent e) {
            JTabbedPane source = (JTabbedPane) e.getSource();
            switch (source.getSelectedIndex()) {
              case 0:
                panelExam.refresh();
                break;
              case 1:
                panelQuestion.refresh();
                break;
              case 2:
                panelAnswer.refresh();
                break;
            }
          }
        });
    add(tabbedPane);
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    panelQuestion.refresh();
  }
예제 #8
0
  public PanelGlowny() {
    super(new GridLayout(1, 1));

    panel = new JTabbedPane();
    // EkranRysowanie();
    EkranFormularz();

    // EkranWyswietlFigure();

    // EkranZamowienie();
    panel.setSelectedComponent(form);
    this.add(panel);

    panel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
  }
예제 #9
0
  private void buildDialog() {
    dialog =
        new SwingConfigurationDialogImpl(
            "SoapUI Preferences",
            HelpUrls.PREFERENCES_HELP_URL,
            "Set global SoapUI settings",
            UISupport.OPTIONS_ICON);

    tabs = new JTabbedPane();
    tabs.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    tabs.setTabPlacement(JTabbedPane.LEFT);
    for (Prefs pref : prefs) {
      tabs.addTab(pref.getTitle(), new JScrollPane(pref.getForm().getPanel()));
    }

    dialog.setContent(UISupport.createTabPanel(tabs, false));
  }
 public WindowMonitorController(MonitorControllerHWC mntr, TreePane tpane) {
   super("Monitor: " + mntr.toString(), true, true, true, true);
   myMonitor = mntr;
   myController = myMonitor.getMyController();
   treePane = tpane;
   enabled = myMonitor.isEnabled();
   setSize(400, 500);
   int n = treePane.getInternalFrameCount();
   setLocation(20 * n, 20 * n);
   AdapterWindowMonitorController listener = new AdapterWindowMonitorController();
   addInternalFrameListener(listener);
   addComponentListener(listener);
   JTabbedPane tabbedPane = new JTabbedPane();
   tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
   fillConfigurationPanel();
   tabbedPane.add("Configuration", new JScrollPane(confPanel));
   getContentPane().add(tabbedPane);
 }
예제 #11
0
  /**
   * kolye amaliyat marbut be tab pane ::>> ijad va bastan va neshan dadan change baraye taghir
   * address createtab baraye jologiry az oftadan tu halghe
   */
  private void tabPaneConfigure() {
    tab = new JTabbedPane();

    createTab("Google", "http://www.google.com");
    tab.addChangeListener(
        new ChangeListener() {

          @Override
          public void stateChanged(ChangeEvent arg0) {
            if (tabcreate
                && tab.getTabCount() - 1 == ((JTabbedPane) arg0.getSource()).getSelectedIndex()) {
              tabcreate = false;
              createTab("New Tab", "");
              tabcreate = false;
              tab.setSelectedIndex(tab.getTabCount() - 2);
              change = true;
              tabcreate = false;
            }
            tabcreate = true;

            if (!change) {
              change = true;
              return;
            }
            if (((JTabbedPane) arg0.getSource()).getSelectedIndex() >= tabAccess.size()
                || (((JTabbedPane) arg0.getSource()).getSelectedIndex()) < 0) {
              return;
            }
            updateforwardImage();
            updateBackImage(null);
            Tab tabee = tabAccess.get(((JTabbedPane) arg0.getSource()).getSelectedIndex());

            if (tabee != null) {
              addressBar.setText(tabee.getAdress());
            }
            updateforwardImage();
            updateBackImage(null);
          }
        });
    tab.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    add(tab);
  }
예제 #12
0
  public static void init(
      JTabbedPane comp, Thing thing, Container parent, ActionContext actionContext) {
    JComponentCreator.init(comp, thing, parent, actionContext);

    Integer tabLayoutPolicy = null;
    String v = thing.getString("tabLayoutPolicy");
    if ("WRAP_TAB_LAYOUT".equals(v)) {
      tabLayoutPolicy = JTabbedPane.WRAP_TAB_LAYOUT;
    } else if ("WRAP_TAB_LAYOUT".equals(v)) {
      tabLayoutPolicy = JTabbedPane.WRAP_TAB_LAYOUT;
    }
    if (tabLayoutPolicy != null) {
      comp.setTabLayoutPolicy(tabLayoutPolicy);
    }

    Integer tabPlacement = JavaCreator.createInteger(thing, "tabPlacement");
    if (tabPlacement != null) {
      comp.setTabPlacement(tabPlacement);
    }
  }
예제 #13
0
  public CytoPanelImp(
      final CytoPanelName compassDirection,
      final int tabPlacement,
      final CytoPanelState cytoPanelState,
      final CySwingApplication cySwingApp,
      final CyServiceRegistrar serviceRegistrar) {
    this.parent = cySwingApp.getJFrame();
    this.compassDirection = compassDirection;
    this.serviceRegistrar = serviceRegistrar;

    componentsById = new HashMap<>();

    // setup our tabbed pane
    tabbedPane = new JTabbedPane(tabPlacement);
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    tabbedPane.addChangeListener(this);

    // construct our panel
    constructPanel();

    // to hidden by default
    setState(cytoPanelState);
  }
예제 #14
0
  /**
   * Method for adding components to the content pane.
   *
   * @param pane the pane to where the components are added
   */
  private void addComponentsToPane(Container pane) {

    pane.setLayout(new BorderLayout());

    // Panels
    JPanel northPanel = new JPanel();
    JPanel northRightPanel = new JPanel();
    JPanel northLeftPanel = new JPanel();
    JPanel southPanel = new JPanel();

    // list
    this.doneList = new JList(doneListModel);
    this.doneList.addMouseListener(new TodoMouseListener(controller));
    this.doneList.setCellRenderer(new ToDoListRenderer());

    this.deletedList = new JList(deletedListModel);
    this.deletedList.addMouseListener(new TodoMouseListener(controller));
    this.deletedList.setCellRenderer(new ToDoListRenderer());

    this.overdueList = new JList(overdueListModel);
    this.overdueList.addMouseListener(new TodoMouseListener(controller));
    this.overdueList.setCellRenderer(new ToDoListRenderer());

    // table
    this.table = createTable();
    this.table.addMouseListener(new TodoMouseListener(controller));
    this.table.getColumnModel().getColumn(3).setCellRenderer(new ToDoTableRenderer());

    // Scroll pane
    JScrollPane scrollPane = new JScrollPane(table);
    JScrollPane donePane = new JScrollPane(doneList);
    JScrollPane deletePane = new JScrollPane(deletedList);
    JScrollPane overDuePane = new JScrollPane(overdueList);

    // Text fields and buttons
    JTextField inputFld = new JTextField();
    JButton addBtn = new JButton(controller.getAddAction());

    this.testPane = new JTabbedPane();
    this.testPane.addTab(lang.getText("ui.mainview.radiobutton.viewpending"), null, scrollPane);
    this.testPane.addTab(lang.getText("ui.mainview.radiobutton.viewdone"), null, donePane);
    this.testPane.addTab(lang.getText("ui.mainview.radiobutton.viewoverdue"), null, overDuePane);
    this.testPane.addTab(lang.getText("ui.mainview.radiobutton.viewdeleted"), null, deletePane);
    this.testPane.setMnemonicAt(0, KeyEvent.VK_1);
    this.testPane.setMnemonicAt(1, KeyEvent.VK_2);
    this.testPane.setMnemonicAt(2, KeyEvent.VK_3);
    this.testPane.setMnemonicAt(3, KeyEvent.VK_4);

    // Add to pane
    pane.add(testPane, BorderLayout.CENTER);
    pane.add(northPanel, BorderLayout.NORTH);
    pane.add(southPanel, BorderLayout.SOUTH);

    testPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    testPane.setTabPlacement(JTabbedPane.TOP);
    // Set layouts and alignment
    southPanel.setLayout(new BorderLayout());
    northPanel.setLayout(new BorderLayout());
    inputFld.setHorizontalAlignment(JTextField.LEFT);

    // Set up south panel
    southPanel.add(inputFld, BorderLayout.CENTER);
    southPanel.add(addBtn, BorderLayout.EAST);

    // Set up north panel
    northPanel.add(northLeftPanel, BorderLayout.CENTER);
    northPanel.add(northRightPanel, BorderLayout.EAST);

    // Adding clock to north panels
    northRightPanel.add(timeLabel);

    // creates the clock
    final DateFormat timeFormat = new SimpleDateFormat("HH:mm");
    final DateFormat timeFormat2 = new SimpleDateFormat("HH mm");
    ActionListener timerListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Date date = new Date();
            String time;
            if ((date.getTime() / 1000 % 2) == 0) {
              time = timeFormat.format(date); // even seconds
            } else {
              time = timeFormat2.format(date); // odd seconds
            }
            timeLabel.setText(time);
            timeLabel.setFont(new Font("Arial", Font.PLAIN, 15));
            timeLabel.setToolTipText(new SimpleDateFormat("EEE., yyyy-MM-dd HH:mm").format(date));
          }
        };
    Timer timer = new Timer(1000, timerListener);
    // to make sure it doesn't wait one second at the start
    timer.setInitialDelay(0);
    timer.start();

    scrollPane.setColumnHeaderView(createTable().getTableHeader());
    ((AddAction) addBtn.getAction()).setTextField(inputFld);

    inputFld.addKeyListener(
        new KeyAdapter() {
          public void keyReleased(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
              JTextField textField = (JTextField) e.getSource();
              String text = textField.getText();
              controller.addItem(text);
              textField.setText("");
            }
            // String text = textField.getText();
            // textField.setText(text.toUpperCase());

          }
        });
  }
예제 #15
0
  /**
   * Método que genera el dialogo que muestra los datos de un vehiculo
   *
   * @param desktop
   * @param locale
   */
  public VehiculoJDialog(JFrame desktop, String locale) throws Exception {
    super(desktop);
    this.aplicacion = (AppContext) AppContext.getApplicationContext();
    this.locale = locale;
    getContentPane().setLayout(new BorderLayout());
    renombrarComponentes();
    setModal(true);

    datosVehiculoJTabbedPane = new javax.swing.JTabbedPane();
    datosVehiculoJTabbedPane.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
    datosVehiculoJTabbedPane.setFont(new java.awt.Font("Arial", 0, 10));

    datosGenerales1JPanel = new DatosGeneralesComunesJPanel(locale);
    datosGenerales2JPanel = new DatosGeneralesVehiculoJPanel(locale);

    /** Montamos el panel de datos generales */
    datosGeneralesJPanel = new JPanel();
    datosGeneralesJPanel.setBorder(
        new javax.swing.border.TitledBorder(
            aplicacion.getI18nString("inventario.datosGenerales.tag1")));
    datosGeneralesJPanel.setLayout(new BorderLayout());
    datosGeneralesJPanel.add(datosGenerales1JPanel, BorderLayout.CENTER);
    datosGeneralesJPanel.add(datosGenerales2JPanel, BorderLayout.SOUTH);

    datosVehiculoJTabbedPane.addTab(
        aplicacion.getI18nString("inventario.inmuebleDialog.tab1"), datosGeneralesJPanel);

    // Añadmos Listener para detectar los cambios en los valores
    datosGenerales2JPanel
        .getCosteAdquisicionJTField()
        .addFocusListener(new ValorAdqFocusListener());
    datosGenerales2JPanel.getfAdquisicionJTField().addFocusListener(new FechaAdqFocusListener());

    datosAmortizacionJPanel = new DatosAmortizacionJPanel(desktop, locale);
    datosVehiculoJTabbedPane.addTab(
        aplicacion.getI18nString("inventario.inmuebleDialog.tab5"), datosAmortizacionJPanel);

    datosSegurosJPanel = new DatosSegurosJPanel();
    datosVehiculoJTabbedPane.addTab(
        aplicacion.getI18nString("inventario.inmuebleDialog.tab6"), datosSegurosJPanel);

    observacionesJPanel = new ObservacionesJPanel();
    datosVehiculoJTabbedPane.addTab(
        aplicacion.getI18nString("inventario.inmuebleDialog.tab8"), observacionesJPanel);

    documentosJPanel = new GestionDocumentalJPanel(false);
    datosVehiculoJTabbedPane.addTab(
        aplicacion.getI18nString("inventario.inmuebleDialog.tab12"), documentosJPanel);
    if ((operacion != null) && (operacion.equalsIgnoreCase(Constantes.OPERACION_ANNADIR))) {
      documentosJPanel.modificarJButtonSetEnabled(false);
    }

    botoneraAceptarCancelarJPanel = new BotoneraAceptarCancelarJPanel();
    botoneraAceptarCancelarJPanel.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            botoneraAceptarCancelarJPanel_actionPerformed();
          }
        });

    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            exitForm(evt);
          }
        });

    getContentPane().add(datosVehiculoJTabbedPane, BorderLayout.NORTH);
    getContentPane().add(botoneraAceptarCancelarJPanel, BorderLayout.SOUTH);
    // setSize(470, 710);
    setSize(570, 710);
    // setLocation(150, 90);
    GUIUtil.centreOnWindow(this);
    addAyudaOnline();
  }
예제 #16
0
 private void jbInit() throws Exception {
   ////////////////////////////////////////////////////////
   // Init LAF
   ////////////////////////////////////////////////////////
   ButtonGroup grpLAF = new ButtonGroup();
   ActionListener lsnLAF =
       new ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           int iIndex = mvtLAFItem.indexOf(evt.getSource());
           if (iIndex >= 0) changeLAF(iIndex);
         }
       };
   ////////////////////////////////////////////////////////
   UIManager.LookAndFeelInfo laf =
       new UIManager.LookAndFeelInfo(
           "Kunststoff", "com.incors.plaf.kunststoff.KunststoffLookAndFeel");
   marrLaf = UIManager.getInstalledLookAndFeels();
   int iIndex = 0;
   while (iIndex < marrLaf.length && !marrLaf[iIndex].getName().equals(laf.getName())) iIndex++;
   if (iIndex >= marrLaf.length) {
     UIManager.installLookAndFeel(laf);
     marrLaf = UIManager.getInstalledLookAndFeels();
   }
   for (iIndex = 0; iIndex < marrLaf.length; iIndex++) {
     JMenuItem mnu = new JRadioButtonMenuItem(marrLaf[iIndex].getName());
     mnu.addActionListener(lsnLAF);
     mvtLAFItem.addElement(mnu);
     mnuUI.add(mnu);
     grpLAF.add(mnu);
   }
   mnuUI.addSeparator();
   ////////////////////////////////////////////////////////
   // Init language
   ////////////////////////////////////////////////////////
   ButtonGroup grpLanguage = new ButtonGroup();
   ActionListener lsnLanguage =
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           int iIndex = mvtLanguageItem.indexOf(e.getSource());
           if (iIndex >= 0) changeDictionary((String) mvtLanguage.elementAt(iIndex));
         }
       };
   ////////////////////////////////////////////////////////
   String[] str = MonitorDictionary.getSupportedLanguage();
   for (iIndex = 0; iIndex < str.length; iIndex++) {
     JMenuItem mnu =
         new JRadioButtonMenuItem(MonitorDictionary.getDictionary(str[iIndex]).getLanguage());
     mnu.addActionListener(lsnLanguage);
     mvtLanguage.addElement(str[iIndex]);
     mvtLanguageItem.addElement(mnu);
     mnuUI.add(mnu);
     grpLanguage.add(mnu);
   }
   ////////////////////////////////////////////////////////
   // Add to main menu
   ////////////////////////////////////////////////////////
   mnuMain.removeAll();
   mnuMain.add(mnuSystem);
   mnuSystem.add(mnuSystem_Login);
   mnuSystem.add(mnuSystem_ChangePassword);
   mnuSystem.addSeparator();
   mnuSystem.add(mnuSystem_StopServer);
   mnuSystem.add(mnuSystem_EnableThreads);
   mnuMain.add(mnuUI);
   mnuMain.add(mnuHelp);
   mnuHelp.add(mnuHelp_About);
   ////////////////////////////////////////////////////////
   mnuMain.add(chkVietnamese);
   mnuMain.add(lblStatus);
   ////////////////////////////////////////////////////////
   pnlThread.setTabPlacement(JTabbedPane.LEFT);
   pnlThread.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
   ////////////////////////////////////////////////////////
   tblUser.addColumn("", 1, false);
   tblUser.addColumn("", 2, false, Global.FORMAT_DATE_TIME);
   tblUser.addColumn("", 3, false);
   ////////////////////////////////////////////////////////
   JPanel pnlMessage = new JPanel();
   pnlMessage.setLayout(new GridBagLayout());
   pnlMessage.add(
       new JScrollPane(txtBoard),
       new GridBagConstraints(
           0,
           0,
           2,
           1,
           1.0,
           1.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(2, 2, 2, 2),
           0,
           0));
   pnlMessage.add(
       txtMessage,
       new GridBagConstraints(
           0,
           1,
           1,
           1,
           1.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(2, 2, 2, 2),
           0,
           0));
   pnlMessage.add(
       btnSend,
       new GridBagConstraints(
           1,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(2, 2, 2, 2),
           0,
           0));
   txtBoard.setEditable(false);
   txtBoard.setAutoscrolls(true);
   txtBoard.setContentType("text/html");
   clearAll(txtBoard);
   ////////////////////////////////////////////////////////
   JPanel pnlUserButton = new JPanel(new GridLayout(1, 2, 4, 4));
   pnlUserButton.add(btnKick);
   pnlUserButton.add(btnRefresh);
   ////////////////////////////////////////////////////////
   JPanel pnlManager = new JPanel(new GridBagLayout());
   pnlManager.add(
       new JScrollPane(tblUser),
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           1.0,
           1.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(2, 2, 2, 2),
           0,
           0));
   pnlManager.add(
       pnlUserButton,
       new GridBagConstraints(
           0,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(4, 2, 4, 2),
           0,
           0));
   ////////////////////////////////////////////////////////
   pnlUser.setDividerLocation(320);
   pnlUser.setLeftComponent(pnlManager);
   pnlUser.setRightComponent(pnlMessage);
   pnlUser.setOneTouchExpandable(true);
   ////////////////////////////////////////////////////////
   setOrientation(JSplitPane.VERTICAL_SPLIT);
   setOneTouchExpandable(true);
   pnlThread.setVisible(false);
   pnlUser.setVisible(false);
   setTopComponent(pnlThread);
   setBottomComponent(pnlUser);
   ////////////////////////////////////////////////////////
   pmn.add(mnuSelectAll);
   pmn.addSeparator();
   pmn.add(mnuClearSelected);
   pmn.add(mnuClearAll);
   ////////////////////////////////////////////////////////
   setBorder(BorderFactory.createEmptyBorder());
   pnlUser.setBorder(BorderFactory.createEmptyBorder());
   pnlManager.setBorder(
       BorderFactory.createBevelBorder(
           javax.swing.border.BevelBorder.RAISED,
           Color.white,
           UIManager.getColor("Panel.background"),
           UIManager.getColor("Panel.background"),
           UIManager.getColor("Panel.background")));
   pnlMessage.setBorder(
       BorderFactory.createBevelBorder(
           javax.swing.border.BevelBorder.RAISED,
           Color.white,
           UIManager.getColor("Panel.background"),
           UIManager.getColor("Panel.background"),
           UIManager.getColor("Panel.background")));
   ////////////////////////////////////////////////////////
   Skin.applySkin(mnuMain);
   Skin.applySkin(tblUser);
   Skin.applySkin(pmn);
   Skin.applySkin(this);
   ////////////////////////////////////////////////////////
   // Default setting
   ////////////////////////////////////////////////////////
   Hashtable prt = null;
   try {
     prt = Global.loadHashtable(Global.FILE_CONFIG);
   } catch (Exception e) {
     prt = new Hashtable();
   }
   changeLAF(Integer.parseInt(StringUtil.nvl(prt.get("LAF"), "0")));
   changeDictionary(StringUtil.nvl(prt.get("Language"), "VN"));
   Skin.LANGUAGE_CHANGE_LISTENER = this;
   MonitorProcessor.setRootObject(this);
   updateKeyboardUI();
   ////////////////////////////////////////////////////////
   // Event handler
   ////////////////////////////////////////////////////////
   tblUser.addMouseListener(
       new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           if (e.getClickCount() > 1) btnKick.doClick();
         }
       });
   ////////////////////////////////////////////////////////
   btnRefresh.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           try {
             DDTP request = new DDTP();
             request.setRequestID(String.valueOf(System.currentTimeMillis()));
             DDTP response = channel.sendRequest("ThreadProcessor", "queryUserList", request);
             if (response != null) {
               tblUser.setData((Vector) response.getReturn());
               if (mstrChannel != null) removeUser(mstrChannel);
             }
           } catch (Exception e) {
             e.printStackTrace();
             MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
           }
         }
       });
   ////////////////////////////////////////////////////////
   btnKick.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           int iSelected = tblUser.getSelectedRow();
           if (iSelected < 0) return;
           int iResult =
               MessageBox.showConfirmDialog(
                   pnlThread,
                   mdic.getString("ConfirmKick"),
                   Global.APP_NAME,
                   MessageBox.YES_NO_OPTION);
           if (iResult == MessageBox.NO_OPTION) return;
           try {
             String strChannel = (String) tblUser.getRow(iSelected).elementAt(0);
             DDTP request = new DDTP();
             request.setRequestID(String.valueOf(System.currentTimeMillis()));
             request.setString("strChannel", strChannel);
             DDTP response = channel.sendRequest("ThreadProcessor", "kickUser", request);
           } catch (Exception e) {
             e.printStackTrace();
             MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
           }
         }
       });
   ////////////////////////////////////////////////////////
   txtMessage.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           btnSend.doClick();
         }
       });
   ////////////////////////////////////////////////////////
   btnSend.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           if (txtMessage.getText().length() == 0) return;
           try {
             DDTP request = new DDTP();
             request.setString("strMessage", txtMessage.getText());
             channel.sendRequest("ThreadProcessor", "sendMessage", request);
             txtMessage.setText("");
           } catch (Exception e) {
             e.printStackTrace();
             MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
           }
         }
       });
   ////////////////////////////////////////////////////////
   mnuClearAll.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           clearAll(txtBoard);
         }
       });
   ////////////////////////////////////////////////////////
   mnuClearSelected.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           txtBoard.setEditable(true);
           txtBoard.replaceSelection("");
           txtBoard.setEditable(false);
         }
       });
   ////////////////////////////////////////////////////////
   mnuSelectAll.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           txtBoard.requestFocus();
           txtBoard.selectAll();
         }
       });
   ////////////////////////////////////////////////////////
   txtBoard.addMouseListener(
       new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           if (e.getButton() == e.BUTTON3) pmn.show(txtBoard, e.getX(), e.getY());
         }
       });
   ////////////////////////////////////////////////////////
   mnuSystem_Login.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           login();
         }
       });
   ////////////////////////////////////////////////////////
   mnuSystem_ChangePassword.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           changePassword();
         }
       });
   ////////////////////////////////////////////////////////
   mnuSystem_StopServer.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           stopServer();
         }
       });
   ////////////////////////////////////////////////////////
   mnuSystem_EnableThreads.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           manageThreads();
         }
       });
   ////////////////////////////////////////////////////////
   mnuHelp_About.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           WindowManager.centeredWindow(new DialogAbout(PanelThreadManager.this));
         }
       });
   ////////////////////////////////////////////////////////
   chkVietnamese.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           switchKeyboard();
         }
       });
 }
  /* constructor de la clase */
  public BienesRevertiblesJDialog(
      JFrame frame,
      char tipo,
      String locale,
      BienRevertible bienRevertibleAux,
      String operacion,
      String tipoBien)
      throws Exception {
    super(frame);
    this.bienRevertible = bienRevertibleAux;
    tipoOperacion = operacion;
    aplicacion = (AppContext) AppContext.getApplicationContext();
    renombrarComponentes();
    inventarioClient =
        new InventarioClient(
            aplicacion.getString(AppContext.GEOPISTA_CONEXION_ADMINISTRADORCARTOGRAFIA)
                + Constantes.INVENTARIO_SERVLET_NAME);

    getContentPane().setLayout(new BorderLayout());
    /* Cargamos la lista */

    okCancelPanel.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            okCancelPanel_actionPerformed(e);
          }
        });
    this.addComponentListener(
        new java.awt.event.ComponentAdapter() {
          public void componentShown(ComponentEvent e) {
            this_componentShown(e);
          }
        });

    setModal(true);
    boolean enabled =
        Constantes.OPERACION_MODIFICAR.equals(operacion)
            || Constantes.OPERACION_ANNADIR.equals(operacion);
    brp = new BienesRevertiblesPanel(bienRevertible, locale);
    brp.setEnabled(enabled);
    JTabbedPane panelPestanias = new JTabbedPane();
    panelPestanias.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
    panelPestanias.addTab(
        aplicacion.getI18nString("inventario.bienesrevertibles.bienrevertible"), brp);

    brBienes = new BienesRevertiblesBienesJPanel(locale, frame, bienRevertible, tipoBien);
    brBienes.setEnabled(enabled);
    panelPestanias.addTab(
        aplicacion.getI18nString("inventario.bienesrevertibles.listabienes"), brBienes);

    datosSegurosJPanel = new DatosSegurosJPanel();

    /** cargamos el seguro */
    datosSegurosJPanel.load(bienRevertible);
    datosSegurosJPanel.setEnabledDatos(enabled);
    datosSegurosJPanel.setOperacion(operacion);
    panelPestanias.addTab(
        aplicacion.getI18nString("inventario.inmuebleDialog.tab6"), datosSegurosJPanel);

    observacionesJPanel = new ObservacionesJPanel();
    observacionesJPanel.setOperacion(operacion);
    observacionesJPanel.load(bienRevertible == null ? null : bienRevertible.getObservaciones());
    observacionesJPanel.setEnabled(enabled);
    panelPestanias.addTab(
        aplicacion.getI18nString("inventario.inmuebleDialog.tab8"), observacionesJPanel);

    amortizacionJPanel = new DatosAmortizacionJPanel(frame, locale);
    amortizacionJPanel.load(bienRevertible == null ? null : bienRevertible.getCuentaAmortizacion());
    amortizacionJPanel.setEnabled(enabled);
    panelPestanias.addTab(
        aplicacion.getI18nString("inventario.inmuebleDialog.tab5"), amortizacionJPanel);

    documentosJPanel = new GestionDocumentalJPanel(false);
    if (bienRevertible.getId() != null) documentosJPanel.load(bienRevertible);
    documentosJPanel.setEnabled(enabled);
    panelPestanias.addTab(aplicacion.getI18nString("inventario.lote.documentos"), documentosJPanel);

    getContentPane().add(panelPestanias, BorderLayout.CENTER);
    getContentPane().add(okCancelPanel, BorderLayout.SOUTH);
    setSize(490, 700);
    GUIUtil.centreOnWindow(this);
  }
예제 #18
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    // set window size to 25% of screen and set window location to center
    Toolkit kit = Toolkit.getDefaultToolkit();
    Dimension screenSize = kit.getScreenSize();
    Double width = screenSize.getWidth();
    Double height = screenSize.getHeight();
    frame.setBounds(
        Double.valueOf(width / 4).intValue(),
        Double.valueOf(height / 4).intValue(),
        Double.valueOf(width / 2).intValue(),
        Double.valueOf(height / 2).intValue());

    JMenuBar menuBar = new JMenuBar();
    frame.getContentPane().add(menuBar, BorderLayout.NORTH);

    JMenu menu = new JMenu("菜单");
    menuBar.add(menu);

    JMenuItem exitItem = new JMenuItem("退出");
    menu.add(exitItem);
    exitItem.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });

    JMenu tool = new JMenu("工具");
    menuBar.add(tool);

    JMenuItem propertyItem = new JMenuItem("界面风格");
    tool.add(propertyItem);
    propertyItem.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            final PropertyDialog lfDialog = new PropertyDialog(frame, "属性设置", true);

            addLookAndFeelInfo(UIManager.getInstalledLookAndFeels(), lfDialog);

            lfDialog
                .getOkButton()
                .addActionListener(
                    new ActionListener() {
                      public void actionPerformed(ActionEvent e) {
                        lfDialog.setVisible(false);
                        SwingUtilities.updateComponentTreeUI(frame);
                      }
                    });
            lfDialog.setVisible(true);
          }
        });

    final JTabbedPane tabbedPane = new JTabbedPane();
    frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

    JPanel startPanel = new JPanel();
    tabbedPane.addTab("首页", startPanel);
    startPanel.setLayout(new GridLayout(0, 2));

    // 添加部署按钮
    JButton deployButton = new JButton("部署");
    startPanel.add(deployButton);
    deployButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            tabbedPane.add("部署", new DeployJPanel());

            int index = tabbedPane.getTabCount() - 1;
            tabbedPane.setTabComponentAt(index, new TabComponent(tabbedPane));
            tabbedPane.setSelectedIndex(index);
          }
        });
  }
  /** 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);

    // =========================================================================================
  }
예제 #20
0
  public void initComponents() {
    function =
        new Detail(
            "function",
            extractor,
            cz.cvut.felk.cig.jcool.ui.view.ExperimentDetails.Detail.Type.TABLE);
    experiment.addPropertyChangeListener(function);

    methodComponents =
        new DelegatedDetail(
            "methodComponents",
            extractor,
            cz.cvut.felk.cig.jcool.ui.view.ExperimentDetails.Detail.Type.LIST,
            this.model);
    model.addPropertyChangeListener(methodComponents);

    method =
        new DelegatedDetail(
            "method",
            extractor,
            cz.cvut.felk.cig.jcool.ui.view.ExperimentDetails.Detail.Type.TABLE,
            this.model);
    model.addPropertyChangeListener(method);

    solver =
        new Detail(
            "solver",
            extractor,
            cz.cvut.felk.cig.jcool.ui.view.ExperimentDetails.Detail.Type.TABLE);
    experiment.addPropertyChangeListener(solver);

    conditions =
        new Detail(
            "stopconditions",
            extractor,
            cz.cvut.felk.cig.jcool.ui.view.ExperimentDetails.Detail.Type.LIST);
    experiment.addPropertyChangeListener(conditions);

    visualizations =
        new Detail(
            "visualizations",
            extractor,
            cz.cvut.felk.cig.jcool.ui.view.ExperimentDetails.Detail.Type.LIST);
    experiment.addPropertyChangeListener(visualizations);

    JTabbedPane pane = new JTabbedPane();
    pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    if (SystemUtils.IS_OS_MAC) {
      pane.setTabPlacement(JTabbedPane.RIGHT);
    }

    pane.addTab("Function", function);
    pane.addTab("Method", method);
    pane.addTab("MethodComponents", methodComponents);
    pane.addTab("Solver", solver);
    pane.addTab("Conditions", conditions);
    pane.addTab("Visualizations", visualizations);

    setLayout(new BorderLayout());
    add(pane, BorderLayout.CENTER);
  }
예제 #21
0
  public DecoratorWebBrowser(final String home) {
    this.setLayout(new BorderLayout());
    this.home = home;
    tabPane = new JTabbedPane();
    webBrowser = new JWebBrowser(JWebBrowser.destroyOnFinalization());
    webBrowser.setOpaque(false);
    webBrowser.navigate(home);
    webBrowser.addWebBrowserListener(new NWebBrowserListener());
    tabPane.add(home, webBrowser);
    tabPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    tabPane.addChangeListener(
        new ChangeListener() {

          @Override
          public void stateChanged(ChangeEvent e) {
            JTabbedPane panel = (JTabbedPane) e.getSource();
            if (panel != null) {
              JWebBrowser webBrowser = (JWebBrowser) panel.getSelectedComponent();
              updateNavigateButtons(webBrowser);
              updateStatusLabel(webBrowser);
              updateStatusProcessBar(webBrowser);
              updateLocation(webBrowser);
              updateStopButton(webBrowser);
            }
          }
        });

    // register the callback on the tabbed pane
    tabPane.putClientProperty(
        SubstanceLookAndFeel.TABBED_PANE_CLOSE_CALLBACK,
        new TabCloseCallback() {
          public TabCloseKind onAreaClick(
              JTabbedPane tabbedPane, int tabIndex, MouseEvent mouseEvent) {
            return null;
          }

          public TabCloseKind onCloseButtonClick(
              JTabbedPane tabbedPane, int tabIndex, MouseEvent mouseEvent) {
            if (tabIndex == 0 && tabbedPane.getTabCount() == 1) {
              JWebBrowser webBrowser = (JWebBrowser) tabbedPane.getComponentAt(0);
              webBrowser.navigate(home);
              return TabCloseKind.NONE;
            } else return TabCloseKind.THIS;
          }

          public String getAreaTooltip(JTabbedPane tabbedPane, int tabIndex) {
            return null;
          }

          public String getCloseButtonTooltip(JTabbedPane tabbedPane, int tabIndex) {
            return null;
          }
        });

    navigateBar = new NavigateBar();
    add(navigateBar, BorderLayout.NORTH);
    add(tabPane, BorderLayout.CENTER);
    statusBar = new StatusBar();
    add(statusBar, BorderLayout.SOUTH);
    setNavigateBarVisible(true);
    setStatusBarVisible(true);
  }