Ejemplo n.º 1
0
  public TdsMonitor(ucar.util.prefs.PreferencesExt prefs, JFrame parentFrame) throws HTTPException {
    this.mainPrefs = prefs;
    this.parentFrame = parentFrame;

    makeCache();

    fileChooser =
        new FileManager(parentFrame, null, null, (PreferencesExt) prefs.node("FileManager"));

    // the top UI
    tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    managePanel = new ManagePanel((PreferencesExt) mainPrefs.node("ManageLogs"));
    accessLogPanel = new AccessLogPanel((PreferencesExt) mainPrefs.node("LogTable"));
    servletLogPanel = new ServletLogPanel((PreferencesExt) mainPrefs.node("ServletLogPanel"));
    urlDump = new URLDumpPane((PreferencesExt) mainPrefs.node("urlDump"));

    tabbedPane.addTab("ManageLogs", managePanel);
    tabbedPane.addTab("AccessLogs", accessLogPanel);
    tabbedPane.addTab("ServletLogs", servletLogPanel);
    tabbedPane.addTab("UrlDump", urlDump);
    tabbedPane.setSelectedIndex(0);

    setLayout(new BorderLayout());
    add(tabbedPane, BorderLayout.CENTER);

    CredentialsProvider provider = new UrlAuthenticatorDialog(null);
    session = new HTTPSession("TdsMonitor");
    session.setCredentialsProvider(provider);
    session.setUserAgent("TdsMonitor");
  }
Ejemplo n.º 2
0
  // Create the primary panel with sub panels.
  private void createMainPanel() {

    // Create the panels in each tab.
    JPanel capturePanel = createCapturePanel();
    JPanel replayPanel = createReplayPanel();

    // Create the tabs and add the new panels to them.
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Capture", capturePanel);
    tabbedPane.addTab("Replay", replayPanel);

    // Create the buttons that always show to select app.
    JPanel topButtons = new JPanel();
    topButtons.setLayout(new BoxLayout(topButtons, BoxLayout.X_AXIS));
    JButton selectApp = new JButton("Select Application");
    JLabel selectedApp = new JLabel("Selected App: ");
    appName = new JLabel();
    topButtons.add(selectApp);
    topButtons.add(Box.createRigidArea(new Dimension(10, 0)));
    topButtons.add(selectedApp);
    topButtons.add(appName);

    selectApp.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            displayAppFrame();
          }
        });

    // Add the buttons and tab structure.
    add(topButtons, BorderLayout.NORTH);
    add(tabbedPane, BorderLayout.CENTER);
  }
  public MidiConfigurationCanvas(
      BlipBoxApplication application, MidiOutputEventHandler eventhandler, BlipBox sender) {
    this.eventhandler = eventhandler;
    this.sender = sender;

    JTabbedPane tabs = new JTabbedPane();

    JPanel control = new BlipBoxControlPanel(application);
    tabs.addTab("Setup", control);

    ModeConfigurationPanel panel = new ModeConfigurationPanel("Cross");
    modes.put(panel.getOperationMode(), panel);
    tabs.addTab("Cross Mode", panel);
    panel = new ModeConfigurationPanel("Criss");
    modes.put(panel.getOperationMode(), panel);
    tabs.addTab("Criss Mode", panel);

    add(tabs);

    setup("Cross", true, false, false);
    setup("Cross", SensorType.X_SENSOR, "Unassigned");
    setup("Cross", SensorType.Y_SENSOR, "Control Change", 1, Y_NOTES_CC, 0, 127);
    setup("Cross", SensorType.POT_SENSOR, "Control Change", 1, POT_CC, 0, 127);
    setup("Cross", SensorType.BUTTON1_SENSOR, "Mode Change", "Criss");

    setup("Criss", false, false, false);
    setup("Criss", SensorType.X_SENSOR, "Control Change", 1, X_CC, 0, 127);
    setup("Criss", SensorType.Y_SENSOR, "Control Change", 1, Y_CC, 0, 127);
    setup("Criss", SensorType.POT_SENSOR, "Control Change", 1, POT_CC, 0, 127);
    setup("Criss", SensorType.BUTTON1_SENSOR, "Mode Change", "Cross");
  }
Ejemplo n.º 4
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));
  }
Ejemplo n.º 5
0
 private JTabbedPane buildProblemsConsole() {
   // build the problems/console editor
   JTabbedPane tp = new JTabbedPane();
   ImageIcon consoleIcon = makeImageIcon("stock_print-layout-16.png");
   tp.addTab("Problems", addScrollers(problemsView));
   tp.addTab("Console", consoleIcon, addScrollers(consoleView));
   // empty border to give padding around tab pane
   tp.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
   return tp;
 }
Ejemplo n.º 6
0
  /** Create the tabbed panels for the GUI */
  private void createTabs() {

    // Create the tabbed pane
    mainPanel = new JTabbedPane(JTabbedPane.BOTTOM);

    // Create the various panels
    workspacePanel = new JPanel(new BorderLayout());
    userListPanel = new JPanel(new BorderLayout());
    searchPanel = new JPanel(new GridLayout(0, 2));

    // Create the pieces of the workspace panel
    workspaceList.setLayoutOrientation(JList.VERTICAL_WRAP);
    workspacePanel.add(new JScrollPane(workspaceList));
    workspacePanel.add(new JLabel("Local File Listing"), BorderLayout.NORTH);

    // Create the UserList tab
    JPanel labelPanel = new JPanel(new GridLayout(0, 2));
    labelPanel.add(new JLabel("Users Connected:"));
    labelPanel.add(new JLabel("Selected User's Files:"));

    JPanel listPanel = new JPanel(new GridLayout(0, 2));
    listPanel.add(new JScrollPane(userList));
    listPanel.add(new JScrollPane(fileList));

    userList.addMouseListener(mouseHandler);
    fileList.addMouseListener(mouseHandler);

    userListPanel.add(labelPanel, BorderLayout.NORTH);
    userListPanel.add(listPanel, BorderLayout.CENTER);

    // Create Search Panel
    searchPanel = new JPanel(new BorderLayout());
    JPanel searchOpsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    searchName = new JTextField(20);
    searchInit = new JButton("Search");
    searchInit.addMouseListener(mouseHandler);
    String types[] = {"Image", "Video", "Audio", "Any"};
    searchType = new JComboBox(types);
    searchType.setSelectedIndex(3);

    searchOpsPanel.add(new JLabel("Search String"));
    searchOpsPanel.add(searchName);
    searchOpsPanel.add(new JLabel("File Type"));
    searchOpsPanel.add(searchType);
    searchOpsPanel.add(searchInit);

    searchPanel.add(new JScrollPane(searchList));
    searchPanel.add(searchOpsPanel, BorderLayout.NORTH);

    // Add panels to the tab pane
    mainPanel.addTab("Home", workspacePanel);
    mainPanel.addTab("Server", userListPanel);
    mainPanel.addTab("Search", searchPanel);
  }
Ejemplo n.º 7
0
 public static void main(String[] ss) {
   JFrame f = new JFrame("Sample Frame");
   JTabbedPane jtp = new JTabbedPane();
   jtp.addTab("Cities", new Citi());
   jtp.addTab("Colors", new Colo());
   jtp.addTab("Flavors", new Fla());
   f.add(jtp);
   f.setVisible(true);
   f.setSize(400, 400);
   f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   JButton b = new JButton("Sam");
   f.add(b);
 }
Ejemplo n.º 8
0
  // {{{ init() method
  private void init() {
    EditBus.addToBus(this);

    /* Setup panes */
    JPanel content = new JPanel(new BorderLayout(12, 12));
    content.setBorder(new EmptyBorder(12, 12, 12, 12));
    setContentPane(content);

    tabPane = new JTabbedPane();
    tabPane.addTab(jEdit.getProperty("manage-plugins.title"), manager = new ManagePanel(this));
    tabPane.addTab(
        jEdit.getProperty("update-plugins.title"), updater = new InstallPanel(this, true));
    tabPane.addTab(
        jEdit.getProperty("install-plugins.title"), installer = new InstallPanel(this, false));
    EditBus.addToBus(installer);
    content.add(BorderLayout.CENTER, tabPane);

    tabPane.addChangeListener(new ListUpdater());

    /* Create the buttons */
    Box buttons = new Box(BoxLayout.X_AXIS);

    ActionListener al = new ActionHandler();
    mgrOptions = new JButton(jEdit.getProperty("plugin-manager.mgr-options"));
    mgrOptions.addActionListener(al);
    pluginOptions = new JButton(jEdit.getProperty("plugin-manager.plugin-options"));
    pluginOptions.addActionListener(al);
    done = new JButton(jEdit.getProperty("plugin-manager.done"));
    done.addActionListener(al);

    buttons.add(Box.createGlue());
    buttons.add(mgrOptions);
    buttons.add(Box.createHorizontalStrut(6));
    buttons.add(pluginOptions);
    buttons.add(Box.createHorizontalStrut(6));
    buttons.add(done);
    buttons.add(Box.createGlue());

    getRootPane().setDefaultButton(done);

    content.add(BorderLayout.SOUTH, buttons);

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    setIconImage(GUIUtilities.getPluginIcon());

    pack();
    GUIUtilities.loadGeometry(this, parent, "plugin-manager");
    GUIUtilities.addSizeSaver(this, parent, "plugin-manager");
    setVisible(true);
  } // }}}
Ejemplo n.º 9
0
  /**
   * Builds and returns the panel.
   *
   * @return the built panel
   */
  public JComponent buildPanel() {
    initComponents();
    initEventHandling();

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.putClientProperty("jgoodies.noContentBorder", Boolean.TRUE);

    tabbedPane.addTab("Text", buildTextPanel());
    tabbedPane.addTab("Formatted", buildFormattedPanel());
    tabbedPane.addTab("Choices", buildChoicesPanel());
    tabbedPane.addTab("List", buildListPanel());
    tabbedPane.addTab("Misc", buildMiscPanel());
    return tabbedPane;
  }
Ejemplo n.º 10
0
  boolean initControlCenter(String title) {

    this.setTitle(title);
    // set up content pane
    Container content = this.getContentPane();
    content.setLayout(new BorderLayout());
    panelAbout.setLayout(new BorderLayout());

    JTextArea textArea =
        new JTextArea(
            "PlayStation 2 Virtual File System release 1.0 \n\nSpecials thanks to our betatester\nPS2Linux Betatester: Mrbrown and Sarah\nPS2 betatester: Oobles, Caveman, Gamebytes, Ping^Spike, Josekenshin, Padawan, pakor, SandraThx and Rolando\n\nAdded little gui in java swing\nAdded feature to choose directory for media files\nAdded support for properties files\nCheck for updates at ps2dev.org\n\nRelease 1.2\n\nRewrite io with java NIO\nadded console mode support\n");
    textArea.setEditable(false);

    JScrollPane areaScrollPane = new JScrollPane(textArea);
    areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    areaScrollPane.setPreferredSize(new Dimension(250, 250));
    TitledBorder aboutBorder = BorderFactory.createTitledBorder("Change log and Greets");
    aboutBorder.setTitleColor(Color.blue);
    panelAbout.setBorder(aboutBorder);

    panelAbout.add(areaScrollPane);
    // set up tabbed pane
    content.add(jtpMain);

    jtpMain.addTab("Configure", panelChooser);
    jtpMain.addTab("About", panelAbout);
    //  set up display area
    // jtaDisplay.setEditable(false);
    // jtaDisplay.setLineWrap(true);
    // jtaDisplay.setMargin(new Insets(5, 5, 5, 5));
    // jtaDisplay.setFont(
    // new Font("Monospaced", Font.PLAIN, iDEFAULT_FontSize));
    // jspDisplay.setViewportView(jtaDisplay);
    // jspDisplay.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
    // panelConsole.add(jspDisplay, BorderLayout.CENTER);
    // panelConsole.add(jtfCommand, BorderLayout.SOUTH);
    // panelConsole.add(jtaDisplay, BorderLayout.CENTER);

    // listener: window closer
    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });

    this.vResize();
    return true;
  }
 protected void addPage(String _typeOfPage, String _name, String _code, boolean _enabled) {
   cardLayout.show(finalPanel, "TabbedPanel");
   _name = getUniqueName(_name);
   Editor page = createPage(_typeOfPage, _name, _code);
   page.setFont(myFont);
   page.setColor(myColor);
   int index = tabbedPanel.getSelectedIndex();
   if (index == -1) {
     pageList.addElement(page);
     if (tabbedPanel.getTabCount() == 0) {
       tabbedPanel.addTab(
           page.getName(),
           null,
           page.getComponent(),
           tooltip); // This causes an exception sometimes
     } else {
       tabbedPanel.insertTab(
           page.getName(), null, page.getComponent(), tooltip, tabbedPanel.getTabCount());
     }
     index = 0;
   } else {
     index++;
     pageList.insertElementAt(page, index);
     tabbedPanel.insertTab(page.getName(), null, page.getComponent(), tooltip, index);
   }
   tabbedPanel.setSelectedComponent(page.getComponent());
   page.setActive(_enabled);
   if (!_enabled) tabbedPanel.setTitleAt(index, page.getName() + " (D)");
   updatePageCounterField(pageList.size());
   // tabbedPanel.validate(); This hangs the computer when reading a file at start-up !!!???
   tabbedPanel.repaint();
   changed = true;
 }
Ejemplo n.º 12
0
  public MainPanel() {
    super(new BorderLayout());
    pop.add(new NewTabAction("Add", null));
    pop.addSeparator();
    pop.add(new CloseAllAction("Close All", null));
    tabbedPane.setComponentPopupMenu(pop);
    tabbedPane.addTab("aaaaaa", new JScrollPane(new JTree()));
    tabbedPane.addTab("12345678901234567890", new JScrollPane(new JLabel("asdfasdfsadf")));
    tabbedPane.addTab("b", new JScrollPane(new JTree()));

    //         tab.setSelectedIndex(0);
    //         TabPanel titleTab = (TabPanel) tab.getTabComponentAt(0);
    //         titleTab.setButtonVisible(true);

    add(tabbedPane);
    setPreferredSize(new Dimension(320, 240));
  }
Ejemplo n.º 13
0
 /** @see #addTab(String, String, java.awt.Component, String, boolean) */
 public void addTab(
     String title, Icon icon, Component component, String tooltip, boolean closable) {
   super.addTab(title, icon, component, tooltip);
   if (closable) {
     setTabComponentAt(indexOfComponent(component), new TabPanel());
   }
   setSelectedComponent(component);
 }
Ejemplo n.º 14
0
  private void init(EditorPatternButton imgBtn, boolean exact, float similarity, int numMatches) {
    setTitle(_I("winPatternSettings"));
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    _imgBtn = imgBtn;
    Point pos = imgBtn.getLocationOnScreen();
    Debug.log(4, "pattern window: " + pos);
    setLocation(pos.x + imgBtn.getWidth(), pos.y);

    takeScreenshot();
    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    tabPane = new JTabbedPane();
    tabPane.setPreferredSize(new Dimension(790, 700));
    msgApplied = new JLabel[tabMax];

    msgApplied[tabSequence] = new JLabel("...");
    paneNaming = new PatternPaneNaming(_imgBtn, msgApplied[tabSequence++]);
    tabPane.addTab(_I("tabNaming"), paneNaming);

    msgApplied[tabSequence] = new JLabel("...");
    panePreview = createPreviewPanel();
    tabSequence++;
    tabPane.addTab(_I("tabMatchingPreview"), panePreview);

    msgApplied[tabSequence] = new JLabel("...");
    paneTarget = createTargetPanel();
    tabSequence++;
    tabPane.addTab(_I("tabTargetOffset"), paneTarget);

    c.add(tabPane, BorderLayout.CENTER);
    c.add(createButtons(), BorderLayout.SOUTH);
    c.doLayout();
    pack();
    try {
      _screenshot.setParameters(_imgBtn.getFilename(), exact, similarity, numMatches);
    } catch (Exception e) {
      Debug.error(me + "Problem while setting up pattern pane\n%s", e.getMessage());
    }
    setDirty(false);
    setVisible(true);
  }
Ejemplo n.º 15
0
  public Main(JFrame frame) {
    super(new BorderLayout());

    this.frame = frame;

    tabpane = new JTabbedPane();

    algorithm_View = new Algorithm_View();
    algorithm_View.setTabbedPane(tabpane);
    config_View = new Config_View();

    menu = new JMenuBar();
    file = new JMenu("File");
    openFile = new JMenuItem("Load Graph");
    resetView = new JMenuItem("Reset View");
    openFile.addActionListener(this);
    resetView.addActionListener(this);
    file.add(openFile);
    file.add(resetView);

    help = new JMenu("Help");
    about = new JMenuItem("About...");
    helpGeneral = new JMenuItem("Manual");

    about.addActionListener(this);
    helpGeneral.addActionListener(this);

    help.add(about);
    help.add(helpGeneral);
    algorithm_View.setPanel();
    algorithm_View.setFrame(frame);
    algorithm_View.setDrawer(drawer);
    tabpane.addTab("Algorithm", null, algorithm_View, "Algorithm view");
    tabpane.addTab("Config Algorithm", null, config_View, "Algorithm configuration");

    menu.add(file);
    menu.add(help);

    this.add(menu, BorderLayout.NORTH);
    this.add(tabpane, BorderLayout.CENTER);
  }
Ejemplo n.º 16
0
    public OptionFrame(JFrame f) {
      super("Options");
      setSize(320, 240);
      setResizable(false);
      options = new JTabbedPane();
      op1 = new JPanel();
      op1.setLayout(new GridLayout(6, 2));
      op1.add(new JLabel("Run:"));
      op1.add(new JTextField());
      op1.add(new JLabel("Reset JVM:"));
      op1.add(new JTextField());
      op1.add(new JLabel("Open options:"));
      op1.add(new JTextField());
      op1.add(new JLabel("Toggle terminal:"));
      op1.add(new JTextField());

      op2 = new JPanel();
      options.addTab("Key bindings", op1);
      options.addTab("Preferences", op2);
      add(options);
      setLocationRelativeTo(f); // Makes this pop up in the center of the frame
      setVisible(true);
    }
Ejemplo n.º 17
0
 /** Method that initializes any embedded plugins that would add an editor */
 private void initPlugins() {
   plugins = ATPluginFactory.getInstance().getEmbeddedNameEditorPlugins();
   if (plugins != null) {
     for (ATPlugin plugin : plugins) {
       plugin.setEditorField(this);
       HashMap pluginPanels = plugin.getEmbeddedPanels();
       for (Object key : pluginPanels.keySet()) {
         String panelName = (String) key;
         JPanel pluginPanel = (JPanel) pluginPanels.get(key);
         tabbedPane.addTab(panelName, pluginPanel);
       }
     }
   }
 }
  private QueryStatisticsPanel addDMLStatsTab(
      @NotNull Content content, SqlStatementMarker sqlMarker, Icon icon, String s) {
    //        Component[] comps = (content.getComponent()).getComponents();
    //        JTabbedPane tabbedPane = (JTabbedPane) comps[1];
    JTabbedPane tabbedPane = getTabComponent(content);
    QueryStatisticsPanel dmlStatsPanel = new QueryStatisticsPanel();
    dmlStatsPanel.putClientProperty(CREATE_TIME, new Date().getTime());

    tabbedPane.addTab(sqlMarker.getName(), dmlStatsPanel);
    int index = tabbedPane.indexOfTab(sqlMarker.getName());
    tabbedPane.setTabComponentAt(index, new ButtonTabComponent(tabbedPane, icon, sqlMarker));

    return dmlStatsPanel;
  }
  private DataGridPanel addGridPanelTab(
      @NotNull Content content, SqlStatementMarker sqlMarker, Icon icon, String toolTip) {
    JTabbedPane tabbedPane = getTabComponent(content);
    DataGridPanel dataGridPanel = new DataGridPanel();
    dataGridPanel.putClientProperty(CREATE_TIME, new Date().getTime());

    tabbedPane.addTab(sqlMarker.getName(), dataGridPanel);
    int index = tabbedPane.indexOfTab(sqlMarker.getName());
    ButtonTabComponent buttonTab = new ButtonTabComponent(tabbedPane, icon, sqlMarker);
    if (toolTip != null) {
      buttonTab.setToolTipText(toolTip);
    }
    tabbedPane.setTabComponentAt(index, buttonTab);
    return dataGridPanel;
  }
Ejemplo n.º 20
0
  protected WMSPanel addNewPanel(final JTabbedPane tabPane) {
    final WMSPanel wmsPanel = new WMSPanel(null); // the null indicates not to register the panel
    wmsPanel.initialize(this.controller);
    wmsPanel.getJPanel().putClientProperty("WMS_PANEL", wmsPanel);
    tabPane.putClientProperty(wmsPanel.getURLString(), wmsPanel);

    tabPane.addTab("New Server", wmsPanel.getJPanel());
    tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
    tabPane.setToolTipTextAt(tabbedPane.getSelectedIndex(), "Server WMS Contents");

    wmsPanel.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("NewServer")) {
              String serverLocation = (String) evt.getNewValue();

              if (WWUtil.isEmpty(serverLocation)) return;
              //
              //                    // Check to see if it's already open.
              //                    for (int i = 0; i < tabbedPane.getTabCount(); i++)
              //                    {
              //                        JPanel jp = (JPanel) tabbedPane.getTabComponentAt(i);
              //                        if (jp != null)
              //                        {
              //                            WMSPanel wp = (WMSPanel)
              // jp.getClientProperty("WMS_PANEL");
              //                            if (wp != null &&
              // wp.getURLString().equalsIgnoreCase(serverLocation))
              //                            {
              //                                tabbedPane.setSelectedIndex(i); // make it the
              // visible one
              //                                return;
              //                            }
              //                        }
              //                    }

              try {

                addNewPanel(tabPane).contactWMSServer(serverLocation);
              } catch (URISyntaxException e) {
                e.printStackTrace(); // TODO
              }
            }
          }
        });

    return wmsPanel;
  }
  /** 認知症対応共同生活介護(短期利用)パターン領域に内部項目を追加します。 */
  protected void addTypeSymbiosisNursingForDementiaPatterns() {

    typeSymbiosisNursingForDementiaPatterns.addTab("1", getTab1());

    typeSymbiosisNursingForDementiaPatterns.addTab("2", getTab2());
  }
Ejemplo n.º 22
0
  // Constructor receives the filename
  Rolodex(String filename) throws FileNotFoundException {
    File file = new File(filename);
    Scanner scanner = new Scanner(file);

    // Split the line with ~
    while (scanner.hasNext()) {
      tokens = scanner.nextLine().split("~");
      name = tokens[0];
      email = tokens[1];
      pictures = tokens[tokens.length - 1];

      User user = new User();
      user.setUserName(name);
      user.setUserEmail(email);
      user.setPicture(pictures);
      userList.add(user);
    }

    frame = new JFrame("Rolodex");
    frame.setSize(700, 200);

    // Menu
    JMenuBar jmb = new JMenuBar();
    JMenu jmFile = new JMenu("File");
    JMenuItem jmiOpen = new JMenuItem("Open");
    jmiOpen.setEnabled(false);
    JMenuItem jmiExit = new JMenuItem("Exit");
    jmiExit.setMnemonic(KeyEvent.VK_X);
    jmFile.add(jmiOpen);
    jmFile.addSeparator();
    jmFile.add(jmiExit);
    jmb.add(jmFile);

    jmiOpen.addActionListener(this);
    jmiExit.addActionListener(this);

    JMenu jmTabs = new JMenu("Tabs");
    jmTabs.setMnemonic(KeyEvent.VK_T);

    JMenu jmiplacement = new JMenu("Placement");
    JMenuItem jmitop = new JMenuItem("Top");
    JMenuItem jmiright = new JMenuItem("Right");
    JMenuItem jmibottom = new JMenuItem("Bottom");
    JMenuItem jmileft = new JMenuItem("Left");
    jmiplacement.add(jmitop);
    jmiplacement.add(jmiright);
    jmiplacement.add(jmibottom);
    jmiplacement.add(jmileft);

    jmitop.addActionListener(this);
    jmiright.addActionListener(this);
    jmibottom.addActionListener(this);
    jmileft.addActionListener(this);

    JMenu jmilayoutpolicy = new JMenu("Layout policy");
    JMenuItem jmiscroll = new JMenuItem("Scroll");
    JMenuItem jmiwrap = new JMenuItem("Wrap");
    jmilayoutpolicy.add(jmiscroll);
    jmilayoutpolicy.add(jmiwrap);

    jmiscroll.addActionListener(this);
    jmiwrap.addActionListener(this);

    JMenuItem jmidefaults = new JMenuItem("Defaults");
    jmidefaults.setMnemonic(KeyEvent.VK_D);
    jmidefaults.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_MASK));
    jmidefaults.addActionListener(this);
    jmTabs.add(jmiplacement);
    jmTabs.add(jmilayoutpolicy);
    jmTabs.addSeparator();
    jmTabs.add(jmidefaults);
    jmb.add(jmTabs);

    JMenu jmHelp = new JMenu("Help");
    JMenuItem jmiabout = new JMenuItem("About");
    jmiabout.addActionListener(this);
    jmHelp.add(jmiabout);
    jmb.add(jmHelp);

    frame.setJMenuBar(jmb);

    jtp = new JTabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    topPanel = new JPanel();
    topPanel.setLayout(new BorderLayout());

    for (User user : userList) {
      image = new ImageIcon(user.getPicture());
      panel = new JPanel();
      labname = new JLabel("Name: ");
      txtname = new JTextField(20);
      txtname.setText(user.getUserName());
      labemail = new JLabel("Email: ");
      txtemail = new JTextField(20);
      txtemail.setText(user.getUserEmail());
      l = new JLabel(image);
      l.setHorizontalAlignment(SwingConstants.LEFT);
      panel.add(l);
      panel.add(labname);
      panel.add(txtname);
      panel.add(labemail);
      panel.add(txtemail);
      jtp.addTab(user.getUserName(), panel);
      topPanel.add(jtp);
    }

    frame.add(jtp);
    center(frame);
    frame.setVisible(true);
  }
 /** Add a page to the notebook */
 private void addPage(SOAPMonitorPage pg) {
   tabbed_pane.addTab("  " + pg.getHost() + "  ", pg);
   pages.addElement(pg);
 }
Ejemplo n.º 24
0
  /** Construct a new "about&hellip;" dialog */
  public DialogAbout(MDIManager mdimgr) {

    buttonOk = new JButton(localize("button.OK"));
    buttonOk.addActionListener(this);

    JPanel buttonPanel = new JPanel(new FlowLayout(), false);
    buttonPanel.add(buttonOk);

    JPanel logoPanel = new JPanel(new FlowLayout(), false);
    logoPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
    logoPanel.add(PEToolKit.createJLabel("Frankenstein"));

    JPanel infoPanel = new JPanel(new GridLayout(9, 1, 5, 5), true);
    infoPanel.setBorder(new EmptyBorder(10, 60, 10, 10));
    infoPanel.add(
        new JLabel("jPicEdt " + Version.getVersion() + " Built " + Version.getBuildDate()));
    infoPanel.add(new JLabel(localize("about.APictureEditorFor")));
    final String[] addressLines = {
      "(c) Sylvain Reynal",
      "É.N.S.É.A. - Dept. of Physics",
      "6, avenue du Ponceau",
      "F-95014 CERGY Cedex",
      "Fax: +33 (0) 130 736 667",
      "*****@*****.**",
      "http://www.jpicedt.org"
    };
    for (String addressLine : addressLines) infoPanel.add(new JLabel(addressLine));

    JTabbedPane caveatPanel = new JTabbedPane();
    String[] tabKeys = {"license.lines", "license.thirdparty.lines"};
    for (String tabKey : tabKeys) {
      JEditorPane caveatTA = new JEditorPane();
      caveatTA.setContentType("text/html; charset=" + localize(tabKey + ".encoding"));
      caveatTA.setEditable(false);
      caveatTA.setPreferredSize(new Dimension(485, 300));
      JScrollPane scrollCaveat = new JScrollPane(caveatTA);
      caveatTA.setText(localize(tabKey));
      caveatPanel.addTab(localize(tabKey + ".tabname"), null, scrollCaveat, null);
    }

    caveatPanel.setBorder(BorderFactory.createEtchedBorder());

    JPanel upperPanel = new JPanel(new BorderLayout(), false);
    upperPanel.add(logoPanel, BorderLayout.WEST);
    upperPanel.add(infoPanel, BorderLayout.CENTER);
    upperPanel.add(caveatPanel, BorderLayout.SOUTH);
    upperPanel.setBorder(BorderFactory.createEtchedBorder());

    JPanel contentPane = new JPanel(new BorderLayout(5, 5));
    contentPane.add(upperPanel, BorderLayout.NORTH);
    contentPane.add(buttonPanel, BorderLayout.SOUTH);

    String title = localize("about.AboutPicEdt") + " " + Version.getVersion();
    boolean modal = true;
    frame = mdimgr.createDialog(title, modal, contentPane);
    frame.setResizable(true);
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    Dimension dlgSize = frame.getPreferredSize();
    frame.setSize(dlgSize);

    // this.pack();
    frame.setVisible(true);
  }
  private void makeFrame(final Editor editor) {
    dialog = new JFrame(title);
    dialog.setMinimumSize(new Dimension(750, 500));
    tabbedPane = new JTabbedPane();

    makeAndShowTab(false, true);

    tabbedPane.addTab("Libraries", null, librariesContributionTab.panel, "Libraries");
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

    tabbedPane.addTab("Modes", null, modesContributionTab.panel, "Modes");
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

    tabbedPane.addTab("Tools", null, toolsContributionTab.panel, "Tools");
    tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

    tabbedPane.addTab("Examples", null, examplesContributionTab.panel, "Examples");
    tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);

    tabbedPane.addTab("Updates", null, updatesContributionTab.panel, "Updates");
    tabbedPane.setMnemonicAt(4, KeyEvent.VK_5);

    tabbedPane.setUI(new SpacedTabbedPaneUI());
    tabbedPane.setBackground(new Color(0x132638));
    tabbedPane.setOpaque(true);

    for (int i = 0; i < 5; i++) {
      tabbedPane.setToolTipTextAt(i, null);
    }

    makeAndSetTabComponents();

    tabbedPane.addChangeListener(
        new ChangeListener() {

          @Override
          public void stateChanged(ChangeEvent e) {
            for (int i = 0; i < 4; i++) {
              tabLabels[i].setBackground(new Color(0x2d4251));
              tabLabels[i].setForeground(Color.WHITE);
            }
            updateTabPanel.setBackground(new Color(0x2d4251));
            updateTabLabel.setForeground(Color.WHITE);
            int currentIndex = tabbedPane.getSelectedIndex();
            if (currentIndex != 4) {
              tabbedPane
                  .getTabComponentAt(tabbedPane.getSelectedIndex())
                  .setBackground(new Color(0xe0fffd));
              tabbedPane
                  .getTabComponentAt(tabbedPane.getSelectedIndex())
                  .setForeground(Color.BLACK);
            } else {
              updateTabPanel.setBackground(new Color(0xe0fffd));
              updateTabLabel.setForeground(Color.BLACK);
            }
            getActiveTab().contributionListPanel.scrollPane.requestFocusInWindow();
            //        // When the tab is changed update status to the current selected panel
            //        ContributionPanel currentPanel = getActiveTab().contributionListPanel
            //          .getSelectedPanel();
            //        if (currentPanel != null) {
            //          getActiveTab().contributionListPanel.setSelectedPanel(currentPanel);
            //        }
          }
        });

    //    tabbedPane.setSize(450, 400);
    setLayout();

    restartButton = new JButton(Language.text("contrib.restart"));
    restartButton.setVisible(false);
    restartButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {

            Iterator<Editor> iter = editor.getBase().getEditors().iterator();
            while (iter.hasNext()) {
              Editor ed = iter.next();
              if (ed.getSketch().isModified()) {
                int option =
                    Messages.showYesNoQuestion(
                        editor,
                        title,
                        Language.text("contrib.unsaved_changes"),
                        Language.text("contrib.unsaved_changes.prompt"));

                if (option == JOptionPane.NO_OPTION) return;
                else break;
              }
            }

            // Thanks to http://stackoverflow.com/a/4160543
            StringBuilder cmd = new StringBuilder();
            cmd.append(
                System.getProperty("java.home")
                    + File.separator
                    + "bin"
                    + File.separator
                    + "java ");
            for (String jvmArg : ManagementFactory.getRuntimeMXBean().getInputArguments()) {
              cmd.append(jvmArg + " ");
            }
            cmd.append("-cp ")
                .append(ManagementFactory.getRuntimeMXBean().getClassPath())
                .append(" ");
            cmd.append(Base.class.getName());

            try {
              Runtime.getRuntime().exec(cmd.toString());
              System.exit(0);
            } catch (IOException e) {
              e.printStackTrace();
            }
          }
        });

    Toolkit.setIcon(dialog);
    registerDisposeListeners();

    dialog.pack();
    dialog.setLocationRelativeTo(null);
  }
Ejemplo n.º 26
0
  // Here some legacy code makes use of generics. They are tested, so there
  // is no risk of an actual error, but Java issues a warning.
  @SuppressWarnings("unchecked")
  public DialogParameters(
      JFrame parent, Vector<ParameterDescription> vec, boolean strict, Vector<LayerDesc> layers) {
    super(parent, Globals.messages.getString("Param_opt"), true);

    keyb1 = new OSKeybPanel(KEYBMODES.GREEK);
    keyb2 = new OSKeybPanel(KEYBMODES.MISC);
    keyb1.setField(this);
    keyb2.setField(this);
    keyb.addTab("Greek", keyb1);
    keyb.addTab("Misc", keyb2);
    keyb.setVisible(false);
    v = vec;

    int ycount = 0;

    // We create dynamically all the needed elements.
    // For this reason, we work on arrays of the potentially useful Swing
    // objects.

    jtf = new JTextField[MAX_ELEMENTS];
    jcb = new JCheckBox[MAX_ELEMENTS];
    jco = new JComboBox[MAX_ELEMENTS];

    active = false;
    addComponentListener(this);

    GridBagLayout bgl = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    Container contentPane = getContentPane();
    contentPane.setLayout(bgl);
    boolean extStrict = strict;

    ParameterDescription pd;

    int top = 0;

    JLabel lab;

    tc = 0;
    cc = 0;
    co = 0;

    // We process all parameter passed. Depending on its type, a
    // corresponding interface element will be created.
    // A symmetrical operation is done when validating parameters.

    for (ycount = 0; ycount < v.size(); ++ycount) {
      if (ycount > MAX) break;

      pd = (ParameterDescription) v.elementAt(ycount);

      // We do not need to store label objects, since we do not need
      // to retrieve data from them.

      lab = new JLabel(pd.description);
      constraints.weightx = 100;
      constraints.weighty = 100;
      constraints.gridx = 1;
      constraints.gridy = ycount;
      constraints.gridwidth = 1;
      constraints.gridheight = 1;

      // The first element needs a little bit more space at the top.
      if (ycount == 0) top = 10;
      else top = 0;

      // Here we configure the grid layout

      constraints.insets = new Insets(top, 20, 0, 6);

      constraints.fill = GridBagConstraints.VERTICAL;
      constraints.anchor = GridBagConstraints.EAST;
      lab.setEnabled(!(pd.isExtension && extStrict));

      if (!(pd.parameter instanceof Boolean)) contentPane.add(lab, constraints);

      constraints.anchor = GridBagConstraints.WEST;
      constraints.insets = new Insets(top, 0, 0, 0);
      constraints.fill = GridBagConstraints.HORIZONTAL;

      // Now, depending on the type of parameter we create interface
      // elements and we populate the dialog.

      if (pd.parameter instanceof PointG) {
        jtf[tc] = new JTextField(10);
        jtf[tc].setText("" + ((PointG) (pd.parameter)).x);
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        // Disable FidoCadJ extensions in the strict compatibility mode
        jtf[tc].setEnabled(!(pd.isExtension && extStrict));

        contentPane.add(jtf[tc++], constraints);

        jtf[tc] = new JTextField(10);
        jtf[tc].setText("" + ((PointG) (pd.parameter)).y);
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 3;
        constraints.gridy = ycount;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 6, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jtf[tc].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jtf[tc++], constraints);
      } else if (pd.parameter instanceof String) {
        jtf[tc] = new JTextField(24);
        jtf[tc].setText((String) (pd.parameter));
        // If we have a String text field in the first position, its
        // contents should be evidenced, since it is supposed to be
        // the most important field (e.g. for the AdvText primitive)
        if (ycount == 0) jtf[tc].selectAll();
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jtf[tc].setEnabled(!(pd.isExtension && extStrict));

        contentPane.add(jtf[tc++], constraints);

      } else if (pd.parameter instanceof Boolean) {
        jcb[cc] = new JCheckBox(pd.description);
        jcb[cc].setSelected(((Boolean) (pd.parameter)).booleanValue());
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jcb[cc].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jcb[cc++], constraints);
      } else if (pd.parameter instanceof Integer) {
        jtf[tc] = new JTextField(24);
        jtf[tc].setText(((Integer) pd.parameter).toString());
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jtf[tc].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jtf[tc++], constraints);
      } else if (pd.parameter instanceof Float) {
        // TODO.
        // WARNING: (DB) this is supposed to be temporary. In fact, I
        // am planning to upgrade some of the parameters from int
        // to float. But for a few months, the users should not be
        // aware of that, even if the internal representation is
        // slowing being adapted.
        jtf[tc] = new JTextField(24);
        int dummy = java.lang.Math.round((Float) pd.parameter);
        jtf[tc].setText("" + dummy);
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jtf[tc].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jtf[tc++], constraints);
      } else if (pd.parameter instanceof FontG) {
        GraphicsEnvironment gE;
        gE = GraphicsEnvironment.getLocalGraphicsEnvironment();
        String[] s = gE.getAvailableFontFamilyNames();
        jco[co] = new JComboBox();

        for (int i = 0; i < s.length; ++i) {
          jco[co].addItem(s[i]);
          if (s[i].equals(((FontG) pd.parameter).getFamily())) jco[co].setSelectedIndex(i);
        }
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jco[co].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jco[co++], constraints);
      } else if (pd.parameter instanceof LayerInfo) {
        jco[co] = new JComboBox(new Vector<LayerDesc>(layers));
        jco[co].setSelectedIndex(((LayerInfo) pd.parameter).layer);
        jco[co].setRenderer(new LayerCellRenderer());

        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jco[co].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jco[co++], constraints);

      } else if (pd.parameter instanceof ArrowInfo) {
        jco[co] = new JComboBox<ArrowInfo>();
        jco[co].addItem(new ArrowInfo(0));
        jco[co].addItem(new ArrowInfo(1));
        jco[co].addItem(new ArrowInfo(2));
        jco[co].addItem(new ArrowInfo(3));

        jco[co].setSelectedIndex(((ArrowInfo) pd.parameter).style);
        jco[co].setRenderer(new ArrowCellRenderer());

        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jco[co].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jco[co++], constraints);

      } else if (pd.parameter instanceof DashInfo) {

        jco[co] = new JComboBox<DashInfo>();

        for (int k = 0; k < Globals.dashNumber; ++k) {
          jco[co].addItem(new DashInfo(k));
        }

        jco[co].setSelectedIndex(((DashInfo) pd.parameter).style);
        jco[co].setRenderer(new DashCellRenderer());

        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jco[co].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jco[co++], constraints);
      }
    }
    // Put the OK and Cancel buttons and make them active.
    JButton ok = new JButton(Globals.messages.getString("Ok_btn"));
    JButton cancel = new JButton(Globals.messages.getString("Cancel_btn"));
    JButton keybd = new JButton("\u00B6\u2211\u221A"); // phylum
    keybd.setFocusable(false);
    keybd.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // If at this point, the keyboard is not visible, this means
            // that it will become visible in a while. It is better to
            // resize first and then show up the keyboard.
            if (keyb.isVisible()) {
              MIN_WIDTH = 400;
              MIN_HEIGHT = 350;
            } else {
              MIN_WIDTH = 400;
              MIN_HEIGHT = 500;
            }
            // setSize(MIN_WIDTH, MIN_HEIGHT);
            keyb.setVisible(!keyb.isVisible());
            pack();
          }
        });

    constraints.gridx = 0;
    constraints.gridy = ycount++;
    constraints.gridwidth = 4;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.EAST;
    constraints.insets = new Insets(6, 20, 20, 20);

    // Put the OK and Cancel buttons and make them active.
    Box b = Box.createHorizontalBox();
    b.add(keybd); // phylum

    b.add(Box.createHorizontalGlue());
    ok.setPreferredSize(cancel.getPreferredSize());

    if (Globals.okCancelWinOrder) {
      b.add(ok);
      b.add(Box.createHorizontalStrut(12));
      b.add(cancel);

    } else {
      b.add(cancel);
      b.add(Box.createHorizontalStrut(12));
      b.add(ok);
    }
    // b.add(Box.createHorizontalStrut(12));
    contentPane.add(b, constraints);

    constraints.gridx = 0;
    constraints.gridy = ycount;
    constraints.gridwidth = 4;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.EAST;
    constraints.insets = new Insets(6, 20, 20, 20);

    contentPane.add(keyb, constraints);

    ok.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            try {
              int ycount;
              ParameterDescription pd;
              tc = 0;
              cc = 0;
              co = 0;

              // Here we read all the contents of the interface and we
              // update the contents of the parameter description array.

              for (ycount = 0; ycount < v.size(); ++ycount) {
                if (ycount > MAX) break;
                pd = (ParameterDescription) v.elementAt(ycount);

                if (pd.parameter instanceof PointG) {
                  ((PointG) (pd.parameter)).x = Integer.parseInt(jtf[tc++].getText());
                  ((PointG) (pd.parameter)).y = Integer.parseInt(jtf[tc++].getText());
                } else if (pd.parameter instanceof String) {
                  pd.parameter = jtf[tc++].getText();
                } else if (pd.parameter instanceof Boolean) {
                  pd.parameter = Boolean.valueOf(jcb[cc++].isSelected());
                } else if (pd.parameter instanceof Integer) {
                  pd.parameter = Integer.valueOf(Integer.parseInt(jtf[tc++].getText()));
                } else if (pd.parameter instanceof Float) {
                  pd.parameter = Float.valueOf(Float.parseFloat(jtf[tc++].getText()));
                } else if (pd.parameter instanceof FontG) {
                  pd.parameter = new FontG((String) jco[co++].getSelectedItem());
                } else if (pd.parameter instanceof LayerInfo) {
                  pd.parameter = new LayerInfo(jco[co++].getSelectedIndex());
                } else if (pd.parameter instanceof ArrowInfo) {
                  pd.parameter = new ArrowInfo(jco[co++].getSelectedIndex());
                } else if (pd.parameter instanceof DashInfo) {
                  pd.parameter = new DashInfo(jco[co++].getSelectedIndex());
                }
              }
            } catch (NumberFormatException E) {
              // Error detected. Probably, the user has entered an
              // invalid string when FidoCadJ was expecting a numerical
              // input.

              JOptionPane.showMessageDialog(
                  null,
                  Globals.messages.getString("Format_invalid"),
                  "",
                  JOptionPane.INFORMATION_MESSAGE);
              return;
            }

            active = true;
            // Globals.activeWindow.setEnabled(true);
            setVisible(false);
            keyb.setVisible(false);
          }
        });
    cancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            // Globals.activeWindow.setEnabled(true);
            setVisible(false);
            keyb.setVisible(false);
          }
        });
    // Here is an action in which the dialog is closed

    AbstractAction cancelAction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            // Globals.activeWindow.setEnabled(true);
            setVisible(false);
            keyb.setVisible(false);
          }
        };
    DialogUtil.addCancelEscape(this, cancelAction);

    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            // Globals.activeWindow.setEnabled(true);
            keyb.setVisible(false);
          }
        });

    pack();
    DialogUtil.center(this);
    getRootPane().setDefaultButton(ok);
  }
Ejemplo n.º 27
0
  public Check() {
    super(
        "Substance test with very very very very very very very very very very very very very very long title");

    final ClassLoader cl = Thread.currentThread().getContextClassLoader();
    if (UIManager.getLookAndFeel() instanceof SubstanceLookAndFeel) {
      setIconImage(
          SubstanceLogo.getLogoImage(
              SubstanceLookAndFeel.getCurrentSkin(this.getRootPane())
                  .getColorScheme(
                      DecorationAreaType.PRIMARY_TITLE_PANE,
                      ColorSchemeAssociationKind.FILL,
                      ComponentState.ENABLED)));
    }
    SubstanceLookAndFeel.registerSkinChangeListener(
        new SkinChangeListener() {
          @Override
          public void skinChanged() {
            SwingUtilities.invokeLater(
                new Runnable() {
                  @Override
                  public void run() {
                    setIconImage(
                        SubstanceLogo.getLogoImage(
                            SubstanceLookAndFeel.getCurrentSkin(Check.this.getRootPane())
                                .getColorScheme(
                                    DecorationAreaType.PRIMARY_TITLE_PANE,
                                    ColorSchemeAssociationKind.FILL,
                                    ComponentState.ENABLED)));
                  }
                });
          }
        });

    setLayout(new BorderLayout());

    jtp = new JTabbedPane();
    try {
      mainTabPreviewPainter = new MyMainTabPreviewPainter();
      jtp.putClientProperty(LafWidget.TABBED_PANE_PREVIEW_PAINTER, mainTabPreviewPainter);
    } catch (Throwable e) {
    }
    jtp.getModel().addChangeListener(new TabSwitchListener());

    final JXPanel jxPanel = new JXPanel(new BorderLayout());
    toolbar = getToolbar("", 22, true);
    jxPanel.add(toolbar, BorderLayout.NORTH);

    JXStatusBar statusBar = getStatusBar(jxPanel, jtp);
    this.add(statusBar, BorderLayout.SOUTH);

    taskPaneContainer =
        new JXTaskPaneContainer() {
          @Override
          public boolean getScrollableTracksViewportWidth() {
            return false;
          }
        };
    taskPaneContainer.setScrollableTracksViewportHeight(false);
    taskPaneContainer.setScrollableTracksViewportWidth(false);

    mainTaskPane = new JXTaskPane();
    mainTaskPane.setLayout(new BorderLayout());
    JPanel mainControlPanel =
        ControlPanelFactory.getMainControlPanel(this, jtp, mainTabPreviewPainter, toolbar);
    // mainControlPanel.setOpaque(false);
    mainTaskPane.add(mainControlPanel, BorderLayout.CENTER);
    mainTaskPane.setTitle("General settings");
    mainTaskPane.setIcon(getIcon("JFrameColor16"));
    mainTaskPane.setCollapsed(true);
    taskPaneContainer.add(mainTaskPane);

    JPanel dialogControlPanel = ControlPanelFactory.getDialogControlPanel(this);
    JXTaskPane dialogTaskPane = new JXTaskPane();
    dialogTaskPane.setLayout(new BorderLayout());
    dialogTaskPane.add(dialogControlPanel, BorderLayout.CENTER);
    dialogTaskPane.setTitle("Frames & Dialogs");
    dialogTaskPane.setIcon(getIcon("JDialogColor16"));
    dialogTaskPane.setCollapsed(true);
    // dialogTaskPane.setOpaque(false);
    taskPaneContainer.add(dialogTaskPane);

    currentSpecificTaskPane = null;

    final JScrollPane scrollPane =
        new JScrollPane(
            taskPaneContainer,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    SubstanceLookAndFeel.setDecorationType(scrollPane, DecorationAreaType.GENERAL);
    // scrollPane.setOpaque(false);
    // scrollPane.getViewport().setOpaque(false);

    JPanel mainPanel = new JPanel();
    mainPanel.add(scrollPane);
    mainPanel.add(jtp);
    mainPanel.setLayout(
        new LayoutManager() {
          @Override
          public void addLayoutComponent(String name, Component comp) {}

          @Override
          public Dimension minimumLayoutSize(Container parent) {
            Dimension min1 = scrollPane.getMinimumSize();
            Dimension min2 = jtp.getMinimumSize();
            return new Dimension(min1.width + min2.width, min1.height + min2.height);
          }

          @Override
          public void layoutContainer(Container parent) {
            // give 30% width to task pane container and
            // 70% width to the tabbed pane with controls.
            int width = parent.getWidth();
            int height = parent.getHeight();
            scrollPane.setBounds(0, 0, (int) (0.3 * width), height);
            jtp.setBounds((int) (0.3 * width), 0, width - (int) (0.3 * width), height);
          }

          @Override
          public Dimension preferredLayoutSize(Container parent) {
            Dimension pref1 = scrollPane.getPreferredSize();
            Dimension pref2 = jtp.getPreferredSize();
            return new Dimension(pref1.width + pref2.width, pref1.height + pref2.height);
          }

          @Override
          public void removeLayoutComponent(Component comp) {}
        });
    jxPanel.add(mainPanel, BorderLayout.CENTER);

    this.add(jxPanel, BorderLayout.CENTER);

    setPreferredSize(new Dimension(400, 400));
    this.setSize(getPreferredSize());
    setMinimumSize(getPreferredSize());

    ButtonsPanel buttonsPanel = new ButtonsPanel();
    jtp.addTab("Buttons", getIcon("JButtonColor16"), buttonsPanel);
    getRootPane().setDefaultButton(buttonsPanel.defaultButton);

    jtp.addTab("Combo box", getIcon("JComboBoxColor16"), new CombosPanel());

    jtp.addTab("Scroll pane", getIcon("JScrollPaneColor16"), new ScrollPanel());

    TabCloseCallback closeCallback =
        new TabCloseCallback() {
          @Override
          public TabCloseKind onAreaClick(
              JTabbedPane tabbedPane, int tabIndex, MouseEvent mouseEvent) {
            if (mouseEvent.getButton() != MouseEvent.BUTTON3) return TabCloseKind.NONE;
            if (mouseEvent.isShiftDown()) {
              return TabCloseKind.ALL;
            }
            return TabCloseKind.THIS;
          }

          @Override
          public TabCloseKind onCloseButtonClick(
              JTabbedPane tabbedPane, int tabIndex, MouseEvent mouseEvent) {
            if (mouseEvent.isAltDown()) {
              return TabCloseKind.ALL_BUT_THIS;
            }
            if (mouseEvent.isShiftDown()) {
              return TabCloseKind.ALL;
            }
            return TabCloseKind.THIS;
          }

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

          @Override
          public String getCloseButtonTooltip(JTabbedPane tabbedPane, int tabIndex) {
            StringBuffer result = new StringBuffer();
            result.append("<html><body>");
            result.append("Mouse click closes <b>" + tabbedPane.getTitleAt(tabIndex) + "</b> tab");
            result.append(
                "<br><b>Alt</b>-Mouse click closes all tabs but <b>"
                    + tabbedPane.getTitleAt(tabIndex)
                    + "</b> tab");
            result.append("<br><b>Shift</b>-Mouse click closes all tabs");
            result.append("</body></html>");
            return result.toString();
          }
        };

    try {
      TabPanel tp = new TabPanel();
      tp.jtp.putClientProperty(SubstanceLookAndFeel.TABBED_PANE_CLOSE_CALLBACK, closeCallback);
      jtp.addTab("Tabs", getIcon("JTabbedPaneColor16"), tp);
    } catch (NoClassDefFoundError ncdfe) {
    }

    jtp.addTab("Split", new SplitPanel());

    jtp.addTab("Desktop", getIcon("JDesktopPaneColor16"), new DesktopPanel());

    jtp.addTab("Text fields", getIcon("JTextPaneColor16"), new TextFieldsPanel());

    jtp.addTab("Table", getIcon("JTableColor16"), new TablePanel());

    try {
      jtp.addTab("List", getIcon("JListColor16"), new ListPanel());
    } catch (NoClassDefFoundError ncdfe) {
    }

    jtp.addTab("Slider", getIcon("JSliderColor16"), new SliderPanel());

    jtp.addTab("Progress bar", getIcon("JProgressBarColor16"), new ProgressBarPanel());

    jtp.addTab("Spinner", getIcon("JSpinnerColor16"), new SpinnerPanel());

    jtp.addTab("Tree", getIcon("JTreeColor16"), new TreePanel());

    jtp.addTab("File tree", getIcon("JTreeColor16"), new FileTreePanel());

    jtp.addTab("Cards", new CardPanel());

    JPanel verticalButtonPanel = new JPanel();
    verticalButtonPanel.setLayout(new GridLayout(1, 3));
    verticalButtonPanel.add(new JButton("Vert button 1"));
    verticalButtonPanel.add(new JButton("Vert button 2"));
    JPanel smallVerticalButtonPanel = new JPanel();
    smallVerticalButtonPanel.setLayout(new GridLayout(4, 4));
    for (int row = 0; row < 4; row++) {
      for (int col = 0; col < 4; col++) {
        JButton vertButton = new JButton("vert");
        vertButton.setToolTipText("Vertical button " + row + ":" + col);
        smallVerticalButtonPanel.add(vertButton);
      }
    }
    verticalButtonPanel.add(smallVerticalButtonPanel);
    jtp.addTab("V-Buttons", verticalButtonPanel);

    jtp.addTab("Colored", new ColoredControlsPanel());

    jtp.addTab("Colorized", new ColorizedControlsPanel());

    jtp.addTab("Cells", new CellsPanel());

    jtp.addTab("Sizes", new SizesPanel());

    jtp.addTab("H-Align", new HAlignmentPanel());

    jtp.addTab("V-Align", new VAlignmentPanel());

    // sample menu bar
    JMenuBar jmb = new JMenuBar();
    if (UIManager.getLookAndFeel() instanceof SubstanceLookAndFeel) {
      jmb.add(SampleMenuFactory.getSkinMenu());
      jmb.add(SampleMenuFactory.getTransformMenu());
    }
    JMenu coloredMenu = new JMenu("Colors");
    coloredMenu.setMnemonic('0');
    JMenuItem coloredMI = new JMenuItem("Italic red");
    coloredMI.setFont(coloredMI.getFont().deriveFont(Font.ITALIC));
    coloredMI.setForeground(Color.red);
    coloredMenu.add(coloredMI);
    JRadioButtonMenuItem coloredRBMI = new JRadioButtonMenuItem("Bold green");
    coloredRBMI.setFont(coloredRBMI.getFont().deriveFont(Font.BOLD));
    coloredRBMI.setForeground(Color.green);
    coloredMenu.add(coloredRBMI);
    JCheckBoxMenuItem coloredCBMI = new JCheckBoxMenuItem("Big blue");
    coloredCBMI.setFont(coloredCBMI.getFont().deriveFont(32f));
    coloredCBMI.setForeground(Color.blue);
    coloredMenu.add(coloredCBMI);
    JMenu coloredM = new JMenu("Always big magenta");
    coloredM.setForeground(Color.magenta);
    coloredM.setFont(coloredM.getFont().deriveFont(24f));
    coloredMenu.add(coloredM);
    jmb.add(coloredMenu);

    JMenu testMenu = SampleMenuFactory.getTestMenu();
    jmb.add(testMenu);

    JMenu jm4 = new JMenu("Disabled");
    jm4.add(new JMenuItem("dummy4"));
    jm4.setMnemonic('4');
    jmb.add(jm4);
    jm4.setEnabled(false);

    // LAF changing
    jmb.add(SampleMenuFactory.getLookAndFeelMenu(this));
    setJMenuBar(jmb);

    TabCloseCallback closeCallbackMain =
        new TabCloseCallback() {
          @Override
          public TabCloseKind onAreaClick(
              JTabbedPane tabbedPane, int tabIndex, MouseEvent mouseEvent) {
            if (mouseEvent.getButton() != MouseEvent.BUTTON2) return TabCloseKind.NONE;
            if (mouseEvent.isShiftDown()) {
              return TabCloseKind.ALL;
            }
            return TabCloseKind.THIS;
          }

          @Override
          public TabCloseKind onCloseButtonClick(
              JTabbedPane tabbedPane, int tabIndex, MouseEvent mouseEvent) {
            if (mouseEvent.isAltDown()) {
              return TabCloseKind.ALL_BUT_THIS;
            }
            if (mouseEvent.isShiftDown()) {
              return TabCloseKind.ALL;
            }
            return TabCloseKind.THIS;
          }

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

          @Override
          public String getCloseButtonTooltip(JTabbedPane tabbedPane, int tabIndex) {
            StringBuffer result = new StringBuffer();
            result.append("<html><body>");
            result.append("Mouse click closes <b>" + tabbedPane.getTitleAt(tabIndex) + "</b> tab");
            result.append(
                "<br><b>Alt</b>-Mouse click closes all tabs but <b>"
                    + tabbedPane.getTitleAt(tabIndex)
                    + "</b> tab");
            result.append("<br><b>Shift</b>-Mouse click closes all tabs");
            result.append("</body></html>");
            return result.toString();
          }
        };

    jtp.putClientProperty(SubstanceLookAndFeel.TABBED_PANE_CLOSE_CALLBACK, closeCallbackMain);
    SubstanceLookAndFeel.registerTabCloseChangeListener(
        new TabCloseListener() {
          @Override
          public void tabClosed(JTabbedPane tabbedPane, Component tabComponent) {
            out("Closed tab");
          }

          @Override
          public void tabClosing(JTabbedPane tabbedPane, Component tabComponent) {
            out("Closing tab");
          }
        });

    SubstanceLookAndFeel.registerTabCloseChangeListener(
        jtp,
        new VetoableTabCloseListener() {
          @Override
          public void tabClosed(JTabbedPane tabbedPane, Component tabComponent) {
            out("Closed tab - specific");
          }

          @Override
          public void tabClosing(JTabbedPane tabbedPane, Component tabComponent) {
            out("Closing tab - specific");
          }

          @Override
          public boolean vetoTabClosing(JTabbedPane tabbedPane, Component tabComponent) {
            int userCloseAnswer =
                JOptionPane.showConfirmDialog(
                    Check.this,
                    "Are you sure you want to close '"
                        + tabbedPane.getTitleAt(tabbedPane.indexOfComponent(tabComponent))
                        + "' tab?",
                    "Confirm dialog",
                    JOptionPane.YES_NO_OPTION);
            return (userCloseAnswer == JOptionPane.NO_OPTION);
          }
        });

    SubstanceLookAndFeel.registerTabCloseChangeListener(
        jtp,
        new VetoableMultipleTabCloseListener() {
          @Override
          public void tabsClosed(JTabbedPane tabbedPane, Set<Component> tabComponents) {
            out("Closed " + tabComponents.size() + " tabs - specific");
          }

          @Override
          public void tabsClosing(JTabbedPane tabbedPane, Set<Component> tabComponents) {
            out("Closing " + tabComponents.size() + " tabs - specific");
          }

          @Override
          public boolean vetoTabsClosing(JTabbedPane tabbedPane, Set<Component> tabComponents) {
            int userCloseAnswer =
                JOptionPane.showConfirmDialog(
                    Check.this,
                    "Are you sure you want to close " + tabComponents.size() + " tabs?",
                    "Confirm dialog",
                    JOptionPane.YES_NO_OPTION);
            return (userCloseAnswer == JOptionPane.NO_OPTION);
          }
        });

    addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentResized(ComponentEvent e) {
            System.out.println("Size " + getSize());
          }
        });
  }
Ejemplo n.º 28
0
 @Override
 public void addTab(String title, final Component content) {
   super.addTab(title, content);
   setTabComponentAt(getTabCount() - 1, new TabPanel(this, title, content));
 }
Ejemplo n.º 29
0
  public TestFrame(String title) throws HeadlessException {
    super(title);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentPane = this.getContentPane();
    contentPane.setLayout(new BorderLayout());
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BorderLayout());
    JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new BorderLayout());
    final JTextField textField = new JTextField();
    this.addressField = textField;
    JButton button = new JButton("Parse & Render");
    final JTabbedPane tabbedPane = new JTabbedPane();
    final JTree tree = new JTree();
    final JScrollPane scrollPane = new JScrollPane(tree);

    this.tree = tree;

    contentPane.add(topPanel, BorderLayout.NORTH);
    contentPane.add(bottomPanel, BorderLayout.CENTER);

    topPanel.add(new JLabel("URL: "), BorderLayout.WEST);
    topPanel.add(textField, BorderLayout.CENTER);
    topPanel.add(button, BorderLayout.EAST);

    bottomPanel.add(tabbedPane, BorderLayout.CENTER);

    final HtmlPanel panel = new HtmlPanel();
    panel.addSelectionChangeListener(
        new SelectionChangeListener() {
          public void selectionChanged(SelectionChangeEvent event) {
            if (logger.isLoggable(Level.INFO)) {
              logger.info("selectionChanged(): selection node: " + panel.getSelectionNode());
            }
          }
        });
    this.htmlPanel = panel;
    UserAgentContext ucontext = new SimpleUserAgentContext();
    this.rcontext = new LocalHtmlRendererContext(panel, ucontext);

    final JTextArea textArea = new JTextArea();
    this.textArea = textArea;
    textArea.setEditable(false);
    final JScrollPane textAreaSp = new JScrollPane(textArea);

    tabbedPane.addTab("HTML", panel);
    tabbedPane.addTab("Tree", scrollPane);
    tabbedPane.addTab("Source", textAreaSp);
    tabbedPane.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            Component component = tabbedPane.getSelectedComponent();
            if (component == scrollPane) {
              tree.setModel(new NodeTreeModel(panel.getRootNode()));
            } else if (component == textAreaSp) {
              textArea.setText(rcontext.getSourceCode());
            }
          }
        });

    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            process(textField.getText());
          }
        });
  }
Ejemplo n.º 30
0
  // The init method
  public void init() {

    // Set the look and feel
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      return;
    }

    // Create the menuListener
    MenuListener menuListener = new MenuListener();

    // Create the menu bar
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    // Create the file menu
    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);

    // Create the menuitems
    JMenuItem menuItem;
    menuItem = new JMenuItem("Read Particle Location Data");
    fileMenu.add(menuItem);
    menuItem.addActionListener(menuListener);

    menuItem = new JMenuItem("Save Uintah Input File");
    fileMenu.add(menuItem);
    menuItem.addActionListener(menuListener);

    menuItem = new JMenuItem("Exit");
    fileMenu.add(menuItem);
    menuItem.addActionListener(menuListener);

    // Create the main tabbed pane
    mainTabbedPane = new JTabbedPane();

    // Create the panels to be added to the tabbed pane
    uintahInputPanel = new UintahInputPanel(d_partList, this);
    particleGenPanel = new ParticleGeneratePanel(d_partList, this);

    // Add the tabs
    mainTabbedPane.addTab("Uintah Inputs", null, uintahInputPanel, null);
    mainTabbedPane.addTab("Generate Particle Locations", null, particleGenPanel, null);
    mainTabbedPane.setSelectedIndex(0);
    getContentPane().add(mainTabbedPane);

    // Create the help menu
    JMenu helpMenu = new JMenu("Help");
    menuBar.add(helpMenu);

    // Create the menuitems
    menuItem = new JMenuItem("About");
    helpMenu.add(menuItem);
    menuItem.addActionListener(menuListener);

    // Create the invisible help frames
    helpAboutFrame = new HelpAboutFrame();
    helpAboutFrame.pack();

    // Create the Tab Listener
    TabListener tabListener = new TabListener();
    mainTabbedPane.addChangeListener(tabListener);
  }