⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jiggle.java~2~

📁 一个用java写的地震分析软件(无源码)-used to write a seismic analysis software (without source)
💻 JAVA~2~
📖 第 1 页 / 共 5 页
字号:
	Solution sol = mv.getSelectedSolution();
	if (sol != null) {
	    long selId = mv.getSelectedSolution().getId().longValue();
	    catSolList.setSelected(selId);
	    catSolList.setSelected(mv.getSelectedSolution());
	}
	// get list to columns to show in the table
	String catPanelColumns[] = props.getStringArray("catalogColumnList");
	CatalogPanel catalogPanel = new CatalogPanel (catPanelColumns);
	catalogPanel.setSolutionList(catSolList);
	catalogPanel.setUpdateDB(updateable);
	catalogPanel.setTextArea(catTextArea);

	if (verbose) System.out.println ("Creating catPane. ");

        catPanel = new CatPane(catalogPanel, this);

	tabPanel[TAB_CATALOG].removeAll();
	tabPanel[TAB_CATALOG].add(catPanel, BorderLayout.CENTER);

	selectTab(TAB_CATALOG);
//     tabPane.setSelectedIndex(tabPane.indexOfTab(tabTitle[TAB_CATALOG]));
    }


    /**
     * Create the whole GUI.
     */
    public void makeGUI() {

//============================ Build Basic GUI ==========================
// Main Frame,t this is a 'swing' JFRAME

     setSize (props.getInt("mainframeWidth"), props.getInt("mainframeHeight"));
     setLocation(props.getInt("mainframeX"), props.getInt("mainframeY"));

     makeMenu();    // define the main menu

// <ToolBar>

	toolBar = new MainToolBar(this);
	toolBar.setMasterView(mv);		// Sets origin list etc.

	getContentPane().add(toolBar, BorderLayout.NORTH);

// <tab pane>
	tabPane = new JTabbedPane(JTabbedPane.TOP);

     // create the tab panels (note the waveform tab is no made yet)
     for (int i = 0; i < tabPanel.length - 1; i++) {
         makeTabPanel (tabPane, i);
     }

// <PickingPanel> This is a placeholder that will be replaced when an event
// is selected
	System.out.println ("Creating PickingPanel. ");

	JPanel pickPanelTmp = new JPanel(new BorderLayout(), false);
	pickPanelTmp.add(new JLabel("Picking Panel."), BorderLayout.CENTER);

// <scrolling WFGroupPanel> This is a placeholder that will we replaces when an event
// is selected
	System.out.println ("Creating Scroller ");
	JPanel scrollerTmp = new JPanel(new BorderLayout(), false);
	scrollerTmp.add(new JLabel("Waveform Scroller."), BorderLayout.CENTER);

// <wfSplit> make a split pane with the pickPanel and wfScroller
	wfSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
			   false,       // don't repaint until resizing is done
			   pickPanelTmp,      // top component
			   scrollerTmp);      // bottom component

	wfSplit.setOneTouchExpandable(true);

	// if you don't do this the splitpane divider won't move because
	// the contained components won't allow themselves to get small enough
     wfSplit.setMinimumSize(new Dimension(200, 50) );
	tabPane.setMinimumSize(new Dimension(200, 50) );

// main Split or tab

     mainSplit = new JSplitPane(props.getInt("mainSplitOrientation"),
			   false,       // don't repaint until resizing is done
			   wfSplit,     // top/left component
			   tabPane);    // bottom/right component

     // add mainSplit to main frame
     getContentPane().add(mainSplit, BorderLayout.CENTER);

     mainSplit.setOneTouchExpandable(true);  //add widget for fast expansion

// Switch to waveform tab if that flag is set
     if (props.getBoolean("waveformInTab")) {
        putWFinTab();
     }

  // get statusPanel which is a sub-component of the statusBar
  // to show progress of tasks, stuff in into JiggleProperties so all
  // can access it
     statusPanel = statusBar.getStatusPanel();

	getContentPane().add(statusBar, BorderLayout.SOUTH);

// Set main frame title to origin summary string
	setTitle(DEFAULT_FRAME_TITLE);

	updateDataSourceLabels();  // datasource, wfsource, etc.

// now make it visible (frames are created hidden)
//	pack();
	setVisible(true);  // same as show();

    }  // end of makeGUI


    /**
     * Controls user preference of where waveforms are displayed.
     * If waveforms are in a split pane put them in a tab and visa versa.
     */
    protected void toggleTabSplit () {

    // wfPanel is in TAB now, change it to SplitPane.
     if (props.getBoolean("waveformInTab")) {

       tabPanel[TAB_WAVEFORM].remove(wfSplit);   // remove waveforms from tab
       tabPane.remove(tabPanel[TAB_WAVEFORM]);   // remove the tab
       getContentPane().remove(tabPane);
       // tabPanel[TAB_WAVEFORM] = null;
       putWFinSplit();
       props.setProperty( "waveformInTab", false);

    // wfPanel is in SplitPane now, change it to TAB.
         } else {

       getContentPane().remove(mainSplit);
       mainSplit = null;
       putWFinTab();
       props.setProperty( "waveformInTab", true);

     }

    }
    /** */
    protected void putWFinTab() {
        makeTabPanel(tabPane, TAB_WAVEFORM);    // create new tab
        // put waveforms in tab
        tabPanel[TAB_WAVEFORM].add(wfSplit, BorderLayout.CENTER);

        // put tab in frame
        getContentPane().add(tabPane);

        validate();
 //       repaint();
    }

    /** */
    protected void putWFinSplit() {
	  mainSplit = new JSplitPane(props.getInt("mainSplitOrientation"),
			   false,      // don't repaint until resizing is done
			   wfSplit,      // top/left component
			   tabPane);     // bottom/right component

       mainSplit.setOneTouchExpandable(true);  //add widget for fast expansion

       // put splitPane in frame
       getContentPane().add(mainSplit);

       validate();
//       repaint();
       //mainSplit.repaint();
    }

    /**
    * Create a tab pane using info for tab number 'num'.
    */
    private void makeTabPanel (JTabbedPane tabPane, int num) {
        tabPanel[num] =  new JPanel(new BorderLayout(), false);
	   tabPanel[num].add(new JLabel(tabTitle[num]), BorderLayout.CENTER);

        tabPane.addTab(tabTitle[num], null, tabPanel[num], tabTip[num]);
//        tabPane.insertTab(tabTitle[num], null, tabPanel[num], tabTip[num], num);

    }

    /**
    * Select a tab (bring it to front) using the tab enumeration. For example:
    * TAB_MESSSAGE.
    */
    public void selectTab (int tabType) {
      tabPane.setSelectedIndex(tabPane.indexOfTab(tabTitle[tabType]));
    }

  /**
  * This is just an empty panel used as a filler until real data is loaded.
  */
     protected Component makeTextPanel(String text) {
         JPanel panel = new JPanel(false);
         JLabel filler = new JLabel(text);
         filler.setHorizontalAlignment(JLabel.CENTER);
         panel.setLayout(new GridLayout(1, 0));
         panel.add(filler);
         return panel;
     }

/**
 * Save the current Poperties, Frame location and size and exit the application.
 */
  public void stop() {

	releaseAllSolutionLocks();

	saveProperties();      // save user properties

	System.exit(0);
    }

/**
 * Pop dialog asking if preferences should be saved.
 */
    public void savePropertiesDialog() {

    //pop confirming  yes/no dialog:
           int n = JOptionPane.showConfirmDialog(
                   null, "Save current properties to startup file?",
                   "Save Properties?",
                   JOptionPane.YES_NO_OPTION);

	    if (n == JOptionPane.YES_OPTION) saveProperties();
    }
    /**
     * Save all the environment's properties.
     */
    public void saveProperties() {

	// set properties that aren't set dynmically or by other dialogs
	props.put ("mainframeWidth",  String.valueOf(getSize().width));
	props.put ("mainframeHeight",  String.valueOf(getSize().height));
	props.put ("mainframeX",  String.valueOf(getLocation().x));
	props.put ("mainframeY",  String.valueOf(getLocation().y));

     props.saveProperties();

    }

/**
 * Present the shutdown confirmation dialog box.
 * Called no matter which button, menu or widget is used to exit.
 */
    void shutDown () {

    //pop-up confirming  yes/no dialog:
           int yn = JOptionPane.showConfirmDialog(
                   null, "Are you sure you want to exit Jiggle?",
                   "Jiggle: Exit Confirmation",
                   JOptionPane.YES_NO_OPTION);

      if (yn == JOptionPane.YES_OPTION) stop();

    }
/**
 *  Create the menu for the main frame
 */
    public void makeMenu() {
// ------- MENU --------
      menuBar = new JMenuBar();  // create the menu bar

// [File] menu
      JMenu menuFile = new JMenu("File");

      addToMenu ("Open Event", menuFile).setEnabled(true);
      addToMenu ("Close Event", menuFile).setEnabled(true);

      menuFile.addSeparator();

      JMenu printMenu = new JMenu("Print...");
        addSubMenu("Whole Window", printMenu);
        addSubMenu("Zoom & Group", printMenu);
        addSubMenu("Zoom Window", printMenu);
        addSubMenu("Group (in view)", printMenu);
        addSubMenu("Group (all)", printMenu);

	menuFile.add(printMenu);

	menuFile.addSeparator();
	addToMenu ("Exit", menuFile);

        menuBar.add(menuFile);  // add this menu to the menu bar

// [Sort] menu
        JMenu menuSort = new JMenu("Sort",true);

      addToMenu("Distance from hypo", menuSort);
      addToMenu("Distance from this channel", menuSort).setEnabled(true);
      addToMenu("Alphabetically", menuSort).setEnabled(false);
      addToMenu("north to south", menuSort).setEnabled(false);

      menuBar.add(menuSort);

// [View] menu
      JMenu menuView = new JMenu("View",true);

      addToMenu("Load ID", menuView).setEnabled(true);
      addToMenu("Set Time Bounds", menuView).setEnabled(false);
      addToMenu("Set Channel List", menuView).setEnabled(false);

        menuBar.add(menuView);

// [Event] menu
      menuEvent = new JMenu("Solution",true);
      menuEvent.setEnabled(false);  // no event loaded yet

      addToMenu("Locate", menuEvent).setEnabled(true);
      addToMenu("ML calc", menuEvent).setEnabled(true);
      addToMenu("MC calc", menuEvent).setEnabled(true);
      addToMenu("Edit Event Params...", menuEvent).setEnabled(true);
      addToMenu("Edit Comment...", menuEvent).setEnabled(true);

      addToMenu("Delete Event", menuEvent).setEnabled(true);
      menuEvent.addSeparator();
      addToMenu("Delete Picks", menuEvent).setEnabled(true);
      JMenu menuStrip = new JMenu("Strip Picks");
      menuEvent.add(menuStrip);
      addToMenu("By residual", menuStrip);
      addToMenu("By distance", menuStrip);

//      addSubMenu("By residual", menuStrip);
//      addSubMenu("By distance", menuStrip);

      addToMenu("Unassociate Picks",  menuEvent).setEnabled(true);

        menuBar.add(menuEvent);

// [Options] menu
        JMenu menuOptions = new JMenu("Options",true);

 // user control of split orientation
       if (props.getInt("mainSplitOrientation") == JSplitPane.HORIZONTAL_SPLIT) {
	 addToMenu ("Vertical Split", menuOptions);
       } else {
	 addToMenu ("Horizontal Split", menuOptions);
       }
      // Check box in menu
      JCheckBoxMenuItem rowHeaderCheckItem = new JCheckBoxMenuItem("Show Row Headers");
      rowHeaderCheckItem.addActionListener(new RowHeaderCheckBoxListener());
      menuOptions.add(rowHeaderCheckItem);
      rowHeaderCheckItem.setSelected(props.getBoolean("showRowHeaders"));

      // Check box in menu
      JCheckBoxMenuItem segmentCheckItem = new JCheckBoxMenuItem("Show Segments");
      segmentCheckItem.addActionListener(new SegmentCheckBoxListener());
      menuOptions.add(segmentCheckItem);
      segmentCheckItem.setSelected(props.getBoolean("showSegments"));

      // Check box in menu - toggle show/noshow samples when trace is expanded
      JCheckBoxMenuItem showSamplesCheckItem = new JCheckBoxMenuItem("Show Samples");
      showSamplesCheckItem.addActionListener(new ShowSampleCheckBoxListener());
      menuOptions.add(showSamplesCheckItem);
      showSamplesCheckItem.setSelected(props.getBoolean("showSamples"));

      // Check box in menu- toggle show/noshow green phase queue bars
      JCheckBoxMenuItem phaseCueCheckItem = new JCheckBoxMenuItem("Show Phase Cues");
      phaseCueCheckItem.addActionListener(new PhaseCueCheckBoxListener());
      menuOptions.add(phaseCueCheckItem);
      phaseCueCheckItem.setSelected(props.getBoolean("showPhaseCues"));

      // Check box in menu
      JCheckBoxMenuItem scrollTimeSpanCheckItem = new JCheckBoxMenuItem("Show Full Time in Scroller");
      scrollTimeSpanCheckItem.addActionListener(new ScrollTimeSpanCheckBoxListener());
      menuOptions.add(scrollTimeSpanCheckItem);
      scrollTimeSpanCheckItem.setSelected(props.getDouble("secsPerPage")<0.0);

      if (props.getBoolean("waveformInTab")) // set to proper modality given starting state in props
      {
	  addToMenu("Waveforms in SplitPane", menuOptions);
      } else {
	  addToMenu("Waveforms in Tab Panel", menuOptions);
      }

      addToMenu("Reload Channel Cache",  menuOptions);

      menuOptions.addSeparator();

      addToMenu("Edit WaveServer Groups",  menuOptions);

      addToMenu("Group Panel Setup...",  menuOptions);

      addToMenu("Preferences...",  menuOptions);

      menuBar.add(menuOptions);

// [Info] menu
        JMenu menuInfo = new JMenu("Info",true);

      addToMenu("Memory usage", menuInfo);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -