コード例 #1
0
  public void scrollToAttribute(Attribute a) {
    if (!a.getDescriptor().getConfig().equals(getConfig())) {
      logger.fine("Cannot scroll to attribute that isn't attached to this type of descriptor");
      return;
    }
    int rowIndex = getCurrentModel().getRowForDescriptor(a.getDescriptor());
    int colIndex = getCurrentModel().getColumnForAttribute(a);
    JScrollPane scrollPane = (JScrollPane) this.getComponent(0);
    JViewport viewport = (JViewport) scrollPane.getViewport();
    EnhancedTable table = (EnhancedTable) viewport.getView();

    // This rectangle is relative to the table where the
    // northwest corner of cell (0,0) is always (0,0).
    Rectangle rect = table.getCellRect(rowIndex, colIndex, true);

    // The location of the viewport relative to the table
    Point pt = viewport.getViewPosition();

    // Translate the cell location so that it is relative
    // to the view, assuming the northwest corner of the
    // view is (0,0)
    rect.setLocation(rect.x - pt.x, rect.y - pt.y);

    // Scroll the area into view
    viewport.scrollRectToVisible(rect);
  }
コード例 #2
0
ファイル: VText.java プロジェクト: timburrow/OpenVnmrJ
  public VText(SessionShare sshare, ButtonIF vif, String typ) {
    this.vnmrIf = vif;
    setOpaque(false);
    setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    twin = new VTextWin(this, sshare, vif, typ);
    setViewportView(twin);
    JViewport vp = getViewport();
    vp.setBackground(Util.getBgColor());

    orgBg = getBackground();

    ml =
        new MouseAdapter() {
          public void mouseClicked(MouseEvent evt) {
            int clicks = evt.getClickCount();
            int modifier = evt.getModifiers();
            if ((modifier & (1 << 4)) != 0) {
              if (clicks >= 2) {
                ParamEditUtil.setEditObj((VObjIF) evt.getSource());
              }
            }
          }
        };
    new DropTarget(this, this);
    DisplayOptions.addChangeListener(this);
  }
コード例 #3
0
ファイル: VisualBellViewport.java プロジェクト: zieglerm/enh
 @Override
 protected void paintChildren(Graphics g) {
   super.paintChildren(g);
   if (isBellVisible) {
     paintBell(g);
   }
 }
コード例 #4
0
ファイル: Notepad.java プロジェクト: ArcherSys/ArcherSysRuby
  @SuppressWarnings("OverridableMethodCallInConstructor")
  Notepad() {
    super(true);

    // Trying to set Nimbus look and feel
    try {
      for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (Exception ignored) {
    }

    setBorder(BorderFactory.createEtchedBorder());
    setLayout(new BorderLayout());

    // create the embedded JTextComponent
    editor = createEditor();
    // Add this as a listener for undoable edits.
    editor.getDocument().addUndoableEditListener(undoHandler);

    // install the command table
    commands = new HashMap<Object, Action>();
    Action[] actions = getActions();
    for (Action a : actions) {
      commands.put(a.getValue(Action.NAME), a);
    }

    JScrollPane scroller = new JScrollPane();
    JViewport port = scroller.getViewport();
    port.add(editor);

    String vpFlag = getProperty("ViewportBackingStore");
    if (vpFlag != null) {
      Boolean bs = Boolean.valueOf(vpFlag);
      port.setScrollMode(bs ? JViewport.BACKINGSTORE_SCROLL_MODE : JViewport.BLIT_SCROLL_MODE);
    }

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add("North", createToolbar());
    panel.add("Center", scroller);
    add("Center", panel);
    add("South", createStatusbar());
  }
コード例 #5
0
 public void actionPerformed(ActionEvent e) {
   PrintJob pjob = getToolkit().getPrintJob(textViewerFrame, "Printing Nslm", null);
   if (pjob != null) {
     Graphics pg = pjob.getGraphics();
     if (pg != null) {
       // todo: this should print from
       // the file not from the screen.
       // if (editor1!=null) {
       //    editor1.print(pg); //print crashes, must use printAll
       // }
       // if (scroller1!=null) {
       //    scroller1.printAll(pg); //is clipping on left
       // }
       if (scroller1 != null) {
         JViewport jvp = scroller1.getViewport();
         jvp.printAll(pg);
       }
       pg.dispose();
     }
     pjob.end();
   }
 }
コード例 #6
0
  public void init() {

    // <Begin_init>
    if (getParameter("RESOURCE_PROPERTIES") != null) {
      localePropertiesFileName = getParameter("RESOURCE_PROPERTIES");
    }
    resourceBundle =
        com.adventnet.apiutils.Utility.getBundle(
            localePropertiesFileName, getParameter("RESOURCE_LOCALE"), applet);
    if (initialized) return;
    this.setSize(getPreferredSize().width + 495, getPreferredSize().height + 480);
    setTitle(resourceBundle.getString("ViewConfig"));
    Container container = getContentPane();
    container.setLayout(new BorderLayout());
    try {
      initVariables();
      setUpGUI(container);
      setUpProperties();
      setUpConnections();
    } catch (Exception ex) {
      showStatus(resourceBundle.getString("Error in init method"), ex);
    }
    // let us set the initialized variable to true so
    // we dont initialize again even if init is called
    initialized = true;

    // <End_init>
    setTitle(resourceBundle.getString("View Configuration"));
    setIconImage(AuthMain.getBuilderUiIfInstance().getFrameIcon());
    JLabel1.setIcon(AuthMain.getBuilderUiIfInstance().getImage("viewconfig.png"));
    com.adventnet.security.ui.ViewListCellRenderer ViewListCellRenderer1 =
        new com.adventnet.security.ui.ViewListCellRenderer();
    JTable1.setDefaultRenderer(JTable1.getColumnClass(0), ViewListCellRenderer1);

    JLabel2.setIcon(AuthMain.getBuilderUiIfInstance().getImage("addview1.png"));
    JTable1.getCellEditor(0, 0)
        .getTableCellEditorComponent(JTable1, null, true, 0, 0)
        .setEnabled(false);
    DefaultCellEditor te = (DefaultCellEditor) JTable1.getCellEditor(0, 0);
    te.setClickCountToStart(10);
    JTable1.setCellEditor(te);

    JViewport vp = new JViewport();
    JLabel lab = new JLabel(resourceBundle.getString("List of available views"));
    lab.setHorizontalAlignment((int) JLabel.CENTER_ALIGNMENT);
    lab.setForeground(Color.black);
    vp.setView(lab);

    AuthMain.getBuilderUiIfInstance().centerWindow(this);
    setData();

    viewc = this;

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {
            close();
          }
        });

    /*
    TableColumn col2  = JTable1.getColumnModel().getColumn(1);
    DefaultTableCellRenderer ren = new DefaultTableCellRenderer();
    ren.setIcon(AuthMain.getBuilderUiIfInstance().getImage("task1.png"));
    	col2.setCellRenderer(ren);
     	col2.setMaxWidth(30);
    */

    DefaultListSelectionModel selModel = new DefaultListSelectionModel();
    selModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JTable1.setSelectionModel(selModel);
  }
コード例 #7
0
ファイル: VText.java プロジェクト: timburrow/OpenVnmrJ
 public void propertyChange(PropertyChangeEvent evt) {
   JViewport vp = getViewport();
   if (vp != null) vp.setBackground(Util.getBgColor());
 }