コード例 #1
0
 public void stateChanged(ChangeEvent e) {
   IBrowserComponent component = getActivePage();
   if (component != null && myInactivatedPages.remove(component)) {
     try {
       component.open(myDBFile);
     } catch (Throwable th) {
       open(null);
       showErrorDialog(th);
     }
   }
 }
コード例 #2
0
  public JComponent getComponent() {
    if (myPanel != null) {
      return myPanel;
    }
    myPanel = new JPanel(new BorderLayout());
    mySchemaPage = new SchemaComponent();
    myDataPage = new DataComponent(this, 1000);

    myComponent = new JTabbedPane();

    mySchemaPage.getComponent().putClientProperty(this, mySchemaPage);
    myDataPage.getComponent().putClientProperty(this, myDataPage);

    myComponent.insertTab(
        mySchemaPage.getTitle(), null, mySchemaPage.getComponent(), mySchemaPage.getTip(), 0);
    myComponent.insertTab(
        myDataPage.getTitle(), null, myDataPage.getComponent(), myDataPage.getTip(), 1);

    myInactivatedPages.add(mySchemaPage);
    myInactivatedPages.add(myDataPage);

    myComponent.addChangeListener(this);

    myPanel.add(myComponent, BorderLayout.CENTER);

    JPanel bottomPanel = new JPanel(new BorderLayout());
    final JLabel status =
        new JLabel(
            "<html><body><p>Powered by SQLJet v"
                + SqlJetVersion.getVersionString()
                + "<br>&copy; 2009-2013, TMate Software, <a href=\"http://sqljet.com/\">http://sqljet.com/</a></p></body></html>");
    status.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    status.addMouseListener(
        new MouseAdapter() {

          @Override
          public void mouseClicked(MouseEvent e) {
            DBBrowserUtil.browse("http://sqljet.com/");
          }

          @Override
          public void mouseEntered(MouseEvent e) {
            Cursor hand = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
            status.setCursor(hand);
          }

          @Override
          public void mouseExited(MouseEvent e) {
            Cursor normal = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
            status.setCursor(normal);
          }
        });
    bottomPanel.add(status, BorderLayout.WEST);
    myProgress = new JProgressBar();
    myProgress.setBorder(BorderFactory.createEmptyBorder(4, 16, 4, 4));
    myProgress.setStringPainted(true);
    bottomPanel.add(myProgress, BorderLayout.CENTER);
    myPanel.add(bottomPanel, BorderLayout.SOUTH);

    myProgress.setVisible(false);

    return myPanel;
  }