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");
  }
  // Constructor
  public ParticleGeneratePanel(ParticleList particleList, UintahGui parent) {

    // Copy the arguments
    d_particleList = particleList;

    // Initialize particle size distribution
    d_partSizeDist = new ParticleSize();

    // Create the tabbed pane
    partTabbedPane = new JTabbedPane();

    // Create the panels to be added to the tabbed pane
    particleSizeInputPanel = new ParticleSizeDistInputPanel(d_partSizeDist, this);
    particleLocGenPanel = new ParticleLocGeneratePanel(d_particleList, d_partSizeDist, this);

    // Add the tabs
    partTabbedPane.addTab("Size Distribution", null, particleSizeInputPanel, null);
    partTabbedPane.addTab("Generate Locations", null, particleLocGenPanel, null);
    partTabbedPane.setSelectedIndex(0);

    // Create a grid bag
    GridBagLayout gb = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    setLayout(gb);

    // Set the constraints for the tabbed pane
    UintahGui.setConstraints(gbc, GridBagConstraints.CENTER, 1.0, 1.0, 0, 1, 1, 1, 5);
    gb.setConstraints(partTabbedPane, gbc);
    add(partTabbedPane);

    // Add the change listener
    partTabbedPane.addChangeListener(this);
  }
 public void evaluate() {
   try {
     // clear problems and console messages
     problemsView.setText("");
     consoleView.setText("");
     // update status view
     statusView.setText(" Parsing ...");
     tabbedPane.setSelectedIndex(0);
     LispExpr root = Parser.parse(textView.getText());
     statusView.setText(" Running ...");
     tabbedPane.setSelectedIndex(1);
     // update run button
     runButton.setIcon(stopImage);
     runButton.setActionCommand("Stop");
     // start run thread
     runThread = new RunThread(root);
     runThread.start();
   } catch (SyntaxError e) {
     tabbedPane.setSelectedIndex(0);
     System.err.println(
         "Syntax Error at " + e.getLine() + ", " + e.getColumn() + " : " + e.getMessage());
   } catch (Error e) {
     // parsing error
     System.err.println(e.getMessage());
     statusView.setText(" Errors.");
   }
 }
Exemple #4
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);
  }
  /** TabbedPaneDemo Constructor */
  public TabbedPaneDemo(SwingSet2 swingset) {
    // Set the title for this demo, and an icon used to represent this
    // demo inside the SwingSet2 app.
    super(swingset, "TabbedPaneDemo", "toolbar/JTabbedPane.gif");

    // create tab position controls
    JPanel tabControls = new JPanel();
    tabControls.add(new JLabel(getString("TabbedPaneDemo.label")));
    top = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.top")));
    left = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.left")));
    bottom = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.bottom")));
    right = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.right")));
    getDemoPanel().add(tabControls, BorderLayout.NORTH);

    group = new ButtonGroup();
    group.add(top);
    group.add(bottom);
    group.add(left);
    group.add(right);

    top.setSelected(true);

    top.addActionListener(this);
    bottom.addActionListener(this);
    left.addActionListener(this);
    right.addActionListener(this);

    // create tab
    tabbedpane = new JTabbedPane();
    getDemoPanel().add(tabbedpane, BorderLayout.CENTER);

    String name = getString("TabbedPaneDemo.laine");
    JLabel pix = new JLabel(createImageIcon("tabbedpane/laine.jpg", name));
    tabbedpane.add(name, pix);

    name = getString("TabbedPaneDemo.ewan");
    pix = new JLabel(createImageIcon("tabbedpane/ewan.jpg", name));
    tabbedpane.add(name, pix);

    name = getString("TabbedPaneDemo.hania");
    pix = new JLabel(createImageIcon("tabbedpane/hania.jpg", name));
    tabbedpane.add(name, pix);

    name = getString("TabbedPaneDemo.bounce");
    spin = new HeadSpin();
    tabbedpane.add(name, spin);

    tabbedpane
        .getModel()
        .addChangeListener(
            new ChangeListener() {
              public void stateChanged(ChangeEvent e) {
                SingleSelectionModel model = (SingleSelectionModel) e.getSource();
                if (model.getSelectedIndex() == tabbedpane.getTabCount() - 1) {
                  spin.go();
                }
              }
            });
  }
 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;
 }
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == top) {
     tabbedpane.setTabPlacement(JTabbedPane.TOP);
   } else if (e.getSource() == left) {
     tabbedpane.setTabPlacement(JTabbedPane.LEFT);
   } else if (e.getSource() == bottom) {
     tabbedpane.setTabPlacement(JTabbedPane.BOTTOM);
   } else if (e.getSource() == right) {
     tabbedpane.setTabPlacement(JTabbedPane.RIGHT);
   }
 }
Exemple #8
0
 public TabbedPane1() {
   int i = 0;
   for (String flavor : flavors) tabs.addTab(flavors[i], new JButton("Tabbed pane " + i++));
   tabs.addChangeListener(
       new ChangeListener() {
         public void stateChanged(ChangeEvent e) {
           txt.setText("Tab selected: " + tabs.getSelectedIndex());
         }
       });
   add(BorderLayout.SOUTH, txt);
   add(tabs);
 }
Exemple #9
0
  protected void deleteCurrentPanel() {
    JComponent tabPane = (JComponent) tabbedPane.getSelectedComponent();
    if (tabPane == null) return;

    WMSPanel wmsPanel = (WMSPanel) tabPane.getClientProperty(Constants.FEATURE_OWNER_PROPERTY);

    if (tabbedPane.getTabCount()
        > 2) // actually remove the tab only if there is more than one (plus the "+" tab)
    tabbedPane.remove(tabPane);
    else tabbedPane.setTitleAt(1, "New Server");

    if (wmsPanel != null) wmsPanel.clearPanel();
  }
  // {{{ 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);
  } // }}}
  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;
  }
  public void updateConnectionStatus(boolean connected) {
    if (connected == true) {
      headerPanel.setLogoutText();
      loginMenuItem.setText("Logout");
    } else {
      headerPanel.setLoginText();
      loginMenuItem.setText("Login...");
    }
    mainCommandPanel.updateConnectionStatus(connected);
    propertiePanel.updateConnectionStatus(connected);
    cmdConsole.updateConnectionStatus(connected);
    Iterator iterator = plugins.iterator();
    PluginPanel updatePluginPanel = null;
    while (iterator.hasNext()) {
      updatePluginPanel = (PluginPanel) iterator.next();
      updatePluginPanel.updateConnectionStatus(connected);
    }

    if (connected == true) {
      int selected = tabbedPane.getSelectedIndex();
      if (selected >= 2) {
        ((PluginPanel) pluginPanelMap.get("" + selected)).activated();
      }
    }
  }
  private void updateEditorView() {
    editorPane.setText("");
    numParameters = 0;
    try {
      java.util.List elements = editableTemplate.getPrintfElements();
      for (Iterator it = elements.iterator(); it.hasNext(); ) {
        PrintfUtil.PrintfElement el = (PrintfUtil.PrintfElement) it.next();
        if (el.getFormat().equals(PrintfUtil.PrintfElement.FORMAT_NONE)) {
          appendText(el.getElement(), PLAIN_ATTR);
        } else {
          insertParameter(
              (ConfigParamDescr) paramKeys.get(el.getElement()),
              el.getFormat(),
              editorPane.getDocument().getLength());
        }
      }
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(
          this,
          "Invalid Format: " + ex.getMessage(),
          "Invalid Printf Format",
          JOptionPane.ERROR_MESSAGE);

      selectedPane = 1;
      printfTabPane.setSelectedIndex(selectedPane);
      updatePane(selectedPane);
    }
  }
  /** Intialize me */
  private void init() {
    myTables = new ArrayList();
    tableTabbedPane = new JTabbedPane();
    tableTabbedPane.setPreferredSize(new Dimension(450, 200));
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);
    fileMenu.add(GuiUtils.makeMenuItem("New Row", this, "addNewRow"));
    fileMenu.addSeparator();
    fileMenu.add(GuiUtils.makeMenuItem("Open", this, "doOpen"));
    fileMenu.add(GuiUtils.makeMenuItem("Import", this, "doImport"));
    fileMenu.addSeparator();
    fileMenu.add(GuiUtils.makeMenuItem("Export to File", this, "doSaveAs"));
    fileMenu.add(GuiUtils.makeMenuItem("Export to Plugin", this, "exportToPlugin"));
    fileMenu.add(
        GuiUtils.makeMenuItem("Export Selected to Plugin", this, "exportSelectedToPlugin"));
    fileMenu.addSeparator();
    fileMenu.add(GuiUtils.makeMenuItem("Close", this, "doClose"));

    JMenu helpMenu = new JMenu("Help");
    menuBar.add(helpMenu);
    helpMenu.add(GuiUtils.makeMenuItem("Parameter Defaults Help", this, "showHelp"));
    JComponent bottom = GuiUtils.wrap(GuiUtils.makeButton("Close", this, "doClose"));
    contents = GuiUtils.topCenterBottom(menuBar, GuiUtils.inset(tableTabbedPane, 2), bottom);
    setMenuBar(menuBar);
    loadResources(resources);
  }
 /**
  * Copy the given ParamInfo object into the user's editable table
  *
  * @param i the param fino object to copy
  */
 protected void copyToUsers(ParamInfo i) {
   ParamInfo copy = new ParamInfo(i);
   ParamDefaultsTable to = (ParamDefaultsTable) myTables.get(0);
   to.add(copy);
   tableTabbedPane.setSelectedIndex(0);
   to.editRow(copy, true);
 }
 // {{{ processKeyEvent() method
 private void pluginListUpdated() {
   Component selected = tabPane.getSelectedComponent();
   if (selected == installer || selected == updater) {
     installer.updateModel();
     updater.updateModel();
   }
 } // }}}
  /**
   * Load in the {@link ucar.unidata.idv.ui.ParamInfo}-s defined in the xml from the given root
   * Element. Create a new JTable and add it into the GUI.
   *
   * @param root The xml root
   * @param i Which resource is this
   */
  private void addList(Element root, int i) {
    List infos;
    boolean isWritable = resources.isWritableResource(i);
    if (root != null) {
      infos = createParamInfoList(root);
    } else {
      if (!isWritable) {
        return;
      }
      infos = new ArrayList();
    }

    if (infos.size() == 0) {
      //            infos.add(new ParamInfo("", null, null, null, null));
    }
    ParamDefaultsTable table = new ParamDefaultsTable(infos, isWritable);
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    String editableStr = "";
    if (!isWritable) {
      editableStr = " (" + Msg.msg("non-editable") + ") ";
    }
    JLabel label =
        new JLabel(
            "<html>" + Msg.msg("Path: ${param1}", resources.get(i) + editableStr) + "</html>");
    JPanel tablePanel = GuiUtils.topCenter(GuiUtils.inset(label, 4), new JScrollPane(table));

    table.label = resources.getShortName(i);
    tableTabbedPane.add(resources.getShortName(i), tablePanel);
    myTables.add(table);
  }
  /*
   *	Tab has changed. Focus on saved component for the given tab.
   *  When there is no saved component, focus on the first component.
   */
  public void stateChanged(ChangeEvent e) {
    Component key = tabbedPane.getComponentAt(tabbedPane.getSelectedIndex());

    if (key == null) return;

    Component value = tabFocus.get(key);

    //  First time selecting this tab or focus policy is RESET_FOCUS

    if (value == null) {
      key.transferFocus();
      tabFocus.put(key, value);
    } else //  Use the saved component for focusing
    {
      value.requestFocusInWindow();
    }
  }
 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);
 }
  protected JTabbedPane createTestRunViews() {
    JTabbedPane pane = new JTabbedPane();

    FailureRunView lv = new FailureRunView(this);
    fTestRunViews.addElement(lv);
    lv.addTab(pane);

    TestHierarchyRunView tv = new TestHierarchyRunView(this);
    fTestRunViews.addElement(tv);
    tv.addTab(pane);

    pane.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            testViewChanged();
          }
        });
    return pane;
  }
Exemple #21
0
  protected void setUpSRSFrame(URL url, String search) throws IOException {
    if (BigPane.srsFrame == null) {
      BigPane.setUpSRSFrame((2 * desktop.getHeight()) / 3, desktop);
      Border loweredbevel = BorderFactory.createLoweredBevelBorder();
      Border raisedbevel = BorderFactory.createRaisedBevelBorder();
      Border compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel);

      JTextField statusField = new JTextField();
      statusField.setBorder(compound);
      statusField.setEditable(false);
      BigPane.srsFrame.getContentPane().add(statusField, BorderLayout.SOUTH);
    }

    Annotation edPane = new Annotation(url);
    JScrollPane jsp = new JScrollPane(edPane);
    JTabbedPane jtab = (JTabbedPane) BigPane.srsFrame.getContentPane().getComponent(0);
    jtab.insertTab(search, null, jsp, null, 0);
    BigPane.srsFrame.setVisible(true);
  }
  // Tab listener
  public void stateChanged(ChangeEvent e) {

    int curTab = partTabbedPane.getSelectedIndex();
    if (curTab == 0) {
      System.out.println("part gen state changed : display = true");
      particleSizeInputPanel.setVisibleDisplayFrame(true);
    } else {
      System.out.println("part gen state changed : display = false");
      particleLocGenPanel.setVisibleDisplayFrame(true);
    }
  }
  /*
   *  Create using the specified focus policy
   */
  public TabFocusHandler(JTabbedPane tabbedPane, int focusPolicy) {
    if (focusPolicy != RESET_FOCUS && focusPolicy != RETAIN_FOCUS)
      throw new IllegalArgumentException("Invalid focus policy");

    this.tabbedPane = tabbedPane;
    this.focusPolicy = focusPolicy;

    //  Add listeners to manage a tab change

    tabbedPane.addChangeListener(this);
    KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    focusManager.addPropertyChangeListener("permanentFocusOwner", this);
  }
    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);
    }
  /*
   *  Track focus changes and update the current focus component
   *  for the current tab
   */
  public void propertyChange(PropertyChangeEvent e) {
    //  No need to track focus change

    if (exceptions == null && focusPolicy == RESET_FOCUS) return;

    //  Check for exceptions to the focus policy exist

    Component key = tabbedPane.getComponentAt(tabbedPane.getSelectedIndex());

    if (exceptions != null) {
      if (focusPolicy == RESET_FOCUS && !exceptions.contains(key)) return;

      if (focusPolicy == RETAIN_FOCUS && exceptions.contains(key)) return;
    }

    // Track focus changes for the tab

    Component value = (Component) e.getNewValue();

    if (value != null && SwingUtilities.isDescendingFrom(value, key)) {

      tabFocus.put(key, value);
    }
  }
    protected WCSCoveragePanel addTab(int position, String server) {
      // Add a server to the tabbed dialog.
      try {
        WCSCoveragePanel coveragePanel =
            new WCSCoveragePanel(AppFrame.this.getWwd(), server, wcsPanelSize);
        this.tabbedPane.add(coveragePanel, BorderLayout.CENTER);
        String title = coveragePanel.getServerDisplayString();
        this.tabbedPane.setTitleAt(position, title != null && title.length() > 0 ? title : server);

        return coveragePanel;
      } catch (URISyntaxException e) {
        JOptionPane.showMessageDialog(
            null, "Server URL is invalid", "Invalid Server URL", JOptionPane.ERROR_MESSAGE);
        tabbedPane.setSelectedIndex(previousTabIndex);
        return null;
      }
    }
  public void stateChanged(ChangeEvent ce) {
    Object ob = ce.getSource();
    Class<?> cl = ob.getClass();

    if (Debug) {
      System.out.println("MyChangeListener: got stateChanged: Object: " + ob.toString() + "\n");
      System.out.println("MyChangeListener: got stateChanged: Class: " + cl.getName() + "\n");
    }

    if (cl.getName().equals("javax.swing.JTabbedPane")) {
      if (pane == ce.getSource()) {
        int index = pane.getSelectedIndex();
        mLook.stateChanged(index);
      } else {
        System.out.println("The source does NOT equal pane\n");
      }
    }
  }
Exemple #28
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;
  }
Exemple #29
0
  public SwingDnDFrame() {
    setTitle("SwingDnDTest");
    JTabbedPane tabbedPane = new JTabbedPane();

    JList list = SampleComponents.list();
    tabbedPane.addTab("List", list);
    JTable table = SampleComponents.table();
    tabbedPane.addTab("Table", table);
    JTree tree = SampleComponents.tree();
    tabbedPane.addTab("Tree", tree);
    JFileChooser fileChooser = new JFileChooser();
    tabbedPane.addTab("File Chooser", fileChooser);
    JColorChooser colorChooser = new JColorChooser();
    tabbedPane.addTab("Color Chooser", colorChooser);

    final JTextArea textArea = new JTextArea(4, 40);
    JScrollPane scrollPane = new JScrollPane(textArea);
    scrollPane.setBorder(new TitledBorder(new EtchedBorder(), "Drag text here"));

    JTextField textField = new JTextField("Drag color here");
    textField.setTransferHandler(new TransferHandler("background"));

    tabbedPane.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            textArea.setText("");
          }
        });

    tree.setDragEnabled(true);
    table.setDragEnabled(true);
    list.setDragEnabled(true);
    fileChooser.setDragEnabled(true);
    colorChooser.setDragEnabled(true);
    textField.setDragEnabled(true);

    add(tabbedPane, BorderLayout.NORTH);
    add(scrollPane, BorderLayout.CENTER);
    add(textField, BorderLayout.SOUTH);
    pack();
  }
  /** 認知症対応共同生活介護(短期利用)パターン領域に内部項目を追加します。 */
  protected void addTypeSymbiosisNursingForDementiaPatterns() {

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

    typeSymbiosisNursingForDementiaPatterns.addTab("2", getTab2());
  }