javax.swing.JScrollPane Java Examples

The following examples show how to use javax.swing.JScrollPane. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: fosstrak-epcis   Author: Fosstrak   File: QueryClientGui.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Sets up the window used to show the debug output.
 */
private void drawDebugWindow() {
    debugWindow = new JFrame("Debug output");
    debugWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    debugWindow.addWindowListener(this);
    debugWindow.setLocation(500, 100);
    debugWindow.setSize(500, 300);

    dwOutputTextArea = new JTextArea();
    dwOutputScrollPane = new JScrollPane(dwOutputTextArea);
    debugWindow.add(dwOutputScrollPane);

    dwButtonPanel = new JPanel();
    debugWindow.add(dwButtonPanel, BorderLayout.AFTER_LAST_LINE);

    dwClearButton = new JButton("Clear");
    dwClearButton.addActionListener(this);
    dwButtonPanel.add(dwClearButton);
}
 
Example #2
Source Project: jdk8u_jdk   Author: JetBrains   File: XTextAreaPeer.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void uninstallDefaults(JScrollPane c) {
    super.uninstallDefaults(c);

    JScrollBar vsb = scrollpane.getVerticalScrollBar();
    if (vsb != null) {
        if (vsb.getBorder() == vsbBorder) {
            vsb.setBorder(null);
        }
        vsbBorder = null;
    }

    JScrollBar hsb = scrollpane.getHorizontalScrollBar();
    if (hsb != null) {
        if (hsb.getBorder() == hsbBorder) {
            hsb.setBorder(null);
        }
        hsbBorder = null;
    }
}
 
Example #3
Source Project: zap-extensions   Author: zaproxy   File: HighlighterPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void initUi() {
    // This
    this.setLayout(new BorderLayout());
    this.setName("Highlighter");

    // mainPanel
    mainPanel = new JPanel(new BorderLayout());
    this.add(mainPanel);

    // 0: button panel
    initButtonPanel();
    mainPanel.add(buttonPanel, BorderLayout.PAGE_START);

    // 1: userPanel
    userPanel = new JPanel(new BorderLayout());
    reinit();
    mainPanel.add(new JScrollPane(userPanel));
}
 
Example #4
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: XTextAreaPeer.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void uninstallDefaults(JScrollPane c) {
    super.uninstallDefaults(c);

    JScrollBar vsb = scrollpane.getVerticalScrollBar();
    if (vsb != null) {
        if (vsb.getBorder() == vsbBorder) {
            vsb.setBorder(null);
        }
        vsbBorder = null;
    }

    JScrollBar hsb = scrollpane.getHorizontalScrollBar();
    if (hsb != null) {
        if (hsb.getBorder() == hsbBorder) {
            hsb.setBorder(null);
        }
        hsbBorder = null;
    }
}
 
Example #5
Source Project: jdk8u-dev-jdk   Author: frohoff   File: XTextAreaPeer.java    License: GNU General Public License v2.0 6 votes vote down vote up
private PropertyChangeListener createPropertyChangeHandler() {
    return new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent e) {
                String propertyName = e.getPropertyName();

                if (propertyName.equals("componentOrientation")) {
                    JScrollPane pane = (JScrollPane)e.getSource();
                    JScrollBar vsb = pane.getVerticalScrollBar();
                    if (vsb != null) {
                        if (isLeftToRight(pane)) {
                            vsbBorder = new CompoundBorder(new EmptyBorder(0, 4, 0, -4),
                                                           vsb.getBorder());
                        } else {
                            vsbBorder = new CompoundBorder(new EmptyBorder(0, -4, 0, 4),
                                                           vsb.getBorder());
                        }
                        vsb.setBorder(vsbBorder);
                    }
                }
            }};
}
 
Example #6
Source Project: portmapper   Author: kaklakariada   File: PortMapperView.java    License: GNU General Public License v3.0 6 votes vote down vote up
private JComponent getPresetPanel() {
    final ActionMap actionMap = this.getContext().getActionMap(this.getClass(), this);

    final JPanel presetPanel = new JPanel(new MigLayout("", "[grow, fill][]", ""));
    presetPanel.setBorder(BorderFactory
            .createTitledBorder(app.getResourceMap().getString("mainFrame.port_mapping_presets.title")));

    portMappingPresets = new JList<>(new PresetListModel(app.getSettings()));
    portMappingPresets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    portMappingPresets.setLayoutOrientation(JList.VERTICAL);

    portMappingPresets.addListSelectionListener(e -> {
        logger.trace("Selection of preset list has changed: {}", isPresetMappingSelected());
        firePropertyChange(PROPERTY_PRESET_MAPPING_SELECTED, false, isPresetMappingSelected());
    });

    presetPanel.add(new JScrollPane(portMappingPresets), "spany 4, grow");

    presetPanel.add(new JButton(actionMap.get(ACTION_CREATE_PRESET_MAPPING)), "wrap, sizegroup preset_buttons");
    presetPanel.add(new JButton(actionMap.get(ACTION_EDIT_PRESET_MAPPING)), "wrap, sizegroup preset_buttons");
    presetPanel.add(new JButton(actionMap.get(ACTION_REMOVE_PRESET_MAPPING)), "wrap, sizegroup preset_buttons");
    presetPanel.add(new JButton(actionMap.get(ACTION_USE_PRESET_MAPPING)), "wrap, sizegroup preset_buttons");

    return presetPanel;
}
 
Example #7
Source Project: Spark   Author: igniterealtime   File: ChatAreaSendField.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new IconTextField with Icon.
 *
 * @param text the text to use on the button.
 */
public ChatAreaSendField(String text) {
    setLayout(new GridBagLayout());
    setBackground((Color)UIManager.get("TextPane.background"));
    textField = new ChatInputEditor();
    textField.setBorder(null);
    setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.lightGray));
    button = new JButton();
    
    if (Spark.isMac()) {
        button.setContentAreaFilled(false);
    }

    ResourceUtils.resButton(button, text);

    add(button, new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(2, 2, 2, 2), 0, 0));

    button.setVisible(false);
    
    final JScrollPane pane = new JScrollPane(textField);
    pane.setBorder(null);
    add(pane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    button.setEnabled(false);
}
 
Example #8
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: TreePosTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/** Scroll a text area to display a given position near the middle of the visible area. */
private void scroll(final JTextArea t, final int pos) {
    // Using invokeLater appears to give text a chance to sort itself out
    // before the scroll happens; otherwise scrollRectToVisible doesn't work.
    // Maybe there's a better way to sync with the text...
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                Rectangle r = t.modelToView(pos);
                JScrollPane p = (JScrollPane) SwingUtilities.getAncestorOfClass(JScrollPane.class, t);
                r.y = Math.max(0, r.y - p.getHeight() * 2 / 5);
                r.height += p.getHeight() * 4 / 5;
                t.scrollRectToVisible(r);
            } catch (BadLocationException ignore) {
            }
        }
    });
}
 
Example #9
Source Project: netbeans   Author: apache   File: AnalysisControllerUI.java    License: Apache License 2.0 6 votes vote down vote up
private void initComponents(URL ruleBase, String htmlDescription) {
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    HTMLTextArea descriptionArea = new HTMLTextArea();
    HTMLDocument hdoc = (HTMLDocument) descriptionArea.getDocument();
    descriptionArea.setText(htmlDescription);
    descriptionArea.setCaretPosition(0);
    hdoc.setBase(ruleBase);

    JScrollPane descriptionAreaScrollPane = new JScrollPane(descriptionArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    descriptionAreaScrollPane.setPreferredSize(new Dimension(375, 220));

    add(descriptionAreaScrollPane, BorderLayout.CENTER);
}
 
Example #10
Source Project: hottub   Author: dsrg-uoft   File: TableExample2.java    License: GNU General Public License v2.0 6 votes vote down vote up
public TableExample2(String URL, String driver, String user,
        String passwd, String query) {
    JFrame frame = new JFrame("Table");
    frame.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    JDBCAdapter dt = new JDBCAdapter(URL, driver, user, passwd);
    dt.executeQuery(query);

    // Create the table
    JTable tableView = new JTable(dt);

    JScrollPane scrollpane = new JScrollPane(tableView);
    scrollpane.setPreferredSize(new Dimension(700, 300));

    frame.getContentPane().add(scrollpane);
    frame.pack();
    frame.setVisible(true);
}
 
Example #11
Source Project: ThingML-Tradfri   Author: ffleurey   File: BulbPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    
    try {
        //JOptionPane pane = new JOptionPane();
        //pane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
        JDialog dialog = new JDialog((Frame)null, "Result of COAP GET for bulb " + bulb.getName(), false);
        JTextArea msg = new JTextArea(bulb.getJsonObject().toString(4) + "\n");
        msg.setFont(new Font("monospaced", Font.PLAIN, 10));
        msg.setLineWrap(true);
        msg.setWrapStyleWord(true);
        JScrollPane scrollPane = new JScrollPane(msg);
        
        dialog.getContentPane().add(scrollPane);
        dialog.setSize(350, 350);
        //dialog.pack();
        dialog.setVisible(true);
        
        
    } catch (JSONException ex) {
        Logger.getLogger(BulbPanel.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
Example #12
Source Project: gcs   Author: richardwilkes   File: Outline.java    License: Mozilla Public License 2.0 6 votes vote down vote up
@Override
public Insets getAutoscrollInsets() {
    int         margin     = Scale.get(this).scale(AUTO_SCROLL_MARGIN);
    JScrollPane scrollPane = UIUtilities.getAncestorOfType(this, JScrollPane.class);
    if (scrollPane != null) {
        Rectangle bounds = scrollPane.getViewport().getViewRect();
        return new Insets(bounds.y + margin, bounds.x + margin, getHeight() - (bounds.y + bounds.height) + margin, getWidth() - (bounds.x + bounds.width) + margin);
    }
    return new Insets(margin, margin, margin, margin);
}
 
Example #13
Source Project: chuidiang-ejemplos   Author: chuidiang   File: PruebaCorrelacionIdiomas.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
    * A�ade el textArea para mostrar los resultados y el texto generado.
    * @param contenedor Contendor al que a�adir.
    * @param constraints Se ignora
    */
private void anhadeTextAreaParaResultados(Container contenedor )
{
	areaResultados = new JTextArea();
       areaResultados.setLineWrap(true);
       areaResultados.setWrapStyleWord(true);
       areaResultados.setEditable(false);
       areaResultados.setColumns(40);
       areaResultados.invalidate();

       JScrollPane scrollLista = new JScrollPane(areaResultados);
       scrollLista.setBorder(new TitledBorder("Resultados"));
       GridBagConstraints constraints = new GridBagConstraints();
       constraints.gridx = 0;
       constraints.gridy = 2;
       constraints.gridwidth = 4;
       constraints.gridheight = 1;
       constraints.weightx = 1.0;
       constraints.weighty = 1.0;
       constraints.fill = GridBagConstraints.BOTH;
       contenedor.add(scrollLista, constraints);
}
 
Example #14
Source Project: spotbugs   Author: spotbugs   File: MainFrameComponentFactory.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Creates the source code panel, but does not put anything in it.
 */
JPanel createSourceCodePanel() {
    Font sourceFont = new Font("Monospaced", Font.PLAIN, (int) Driver.getFontSize());
    mainFrame.getSourceCodeTextPane().setFont(sourceFont);
    mainFrame.getSourceCodeTextPane().setEditable(false);
    mainFrame.getSourceCodeTextPane().getCaret().setSelectionVisible(true);
    mainFrame.getSourceCodeTextPane().setDocument(SourceCodeDisplay.SOURCE_NOT_RELEVANT);
    JScrollPane sourceCodeScrollPane = new JScrollPane(mainFrame.getSourceCodeTextPane());
    sourceCodeScrollPane.getVerticalScrollBar().setUnitIncrement(20);

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(sourceCodeScrollPane, BorderLayout.CENTER);

    panel.revalidate();
    if (MainFrame.GUI2_DEBUG) {
        System.out.println("Created source code panel");
    }
    return panel;
}
 
Example #15
Source Project: netbeans   Author: apache   File: ZoomManager.java    License: Apache License 2.0 6 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    Scene scene = manager.getScene();
    JScrollPane pane = (JScrollPane) SwingUtilities.getAncestorOfClass(
            JScrollPane.class, scene.getView());
    if (pane == null) {
        // Unlikely, but we cannot assume it exists.
        return;
    }
    JViewport viewport = pane.getViewport();
    Rectangle visRect = viewport.getViewRect();
    Rectangle compRect = scene.getPreferredBounds();
    int zoomX = visRect.width * 100 / compRect.width;
    int zoomY = visRect.height * 100 / compRect.height;
    int zoom = Math.min(zoomX, zoomY);
    manager.setZoom(zoom);
}
 
Example #16
Source Project: RipplePower   Author: cping   File: UIRes.java    License: Apache License 2.0 6 votes vote down vote up
public static void addStyle(JScrollPane jScrollPane, String labelName, boolean bottom) {
	Border line = BorderFactory.createLineBorder(Color.LIGHT_GRAY);
	TitledBorder titled = BorderFactory.createTitledBorder(line, labelName);
	titled.setTitleFont(GraphicsUtils.getFont("Verdana", 0, 13));
	titled.setTitleColor(fontColorTitle);
	Border empty = null;
	if (bottom) {
		empty = new EmptyBorder(5, 8, 5, 8);
	} else {
		empty = new EmptyBorder(5, 8, 0, 8);
	}
	CompoundBorder border = new CompoundBorder(titled, empty);
	jScrollPane.setBorder(border);
	jScrollPane.setForeground(fontColor);
	jScrollPane.setBackground(Color.WHITE);
	jScrollPane.setFont(GraphicsUtils.getFont("Monospaced", 0, 13));
	jScrollPane.setHorizontalScrollBar(null);
}
 
Example #17
Source Project: ramus   Author: Vitaliy-Yakovchuk   File: PreviewView.java    License: GNU General Public License v3.0 6 votes vote down vote up
public PreviewView(ReportEditorView reportEditorView) {
    this.reportEditorView = reportEditorView;
    JScrollPane pane = new JScrollPane(editorPane);
    HTMLEditorKit kit = new HTMLEditorKit() {
        /**
         *
         */
        private static final long serialVersionUID = -8040272164224951314L;

        @Override
        public Document createDefaultDocument() {
            Document document = super.createDefaultDocument();
            document.putProperty("IgnoreCharsetDirective", true);
            return document;
        }
    };

    editorPane.setEditorKit(kit);
    editorPane.setEditable(false);
    this.add(pane, BorderLayout.CENTER);
}
 
Example #18
Source Project: ramus   Author: Vitaliy-Yakovchuk   File: ReportEditorTest.java    License: GNU General Public License v3.0 6 votes vote down vote up
public ReportEditorTest() {
    setSize(1200, 800);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLocationRelativeTo(null);
    JPanel panel = new JPanel(new BorderLayout());

    XMLDiagram diagram = new XMLDiagram();
    ReportEditor editor = new ReportEditor(diagram);

    setContentPane(panel);
    JScrollPane pane = new JScrollPane(editor);

    panel.add(pane, BorderLayout.CENTER);
    JToolBar bar = new JToolBar();
    panel.add(bar, BorderLayout.NORTH);
    for (Action action : editor.getActions()) {
        JButton button = bar.add(action);
        button.setText((String) action.getValue(Action.ACTION_COMMAND_KEY));
    }

}
 
Example #19
Source Project: biojava   Author: biojava   File: MultipleAlignmentJmolDisplay.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Creates a new Frame with the String output representation of the
 * {@link MultipleAlignment}.
 *
 * @param multAln
 * @param result String output
 */
public static void showAlignmentImage(MultipleAlignment multAln,
		String result) {

	JFrame frame = new JFrame();

	String title = multAln.getEnsemble().getAlgorithmName() +
			" V."+multAln.getEnsemble().getVersion();
	frame.setTitle(title);
	frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

	AlignmentTextPanel txtPanel = new AlignmentTextPanel();
	txtPanel.setText(result);

	JMenuBar menu = MenuCreator.getAlignmentTextMenu(
			frame,txtPanel,null,multAln);

	frame.setJMenuBar(menu);
	JScrollPane js = new JScrollPane();
	js.getViewport().add(txtPanel);
	js.getViewport().setBorder(null);

	frame.getContentPane().add(js);
	frame.pack();
	frame.setVisible(true);
}
 
Example #20
Source Project: rcrs-server   Author: roborescue   File: ScoreTable.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public JComponent getGUIComponent() {
    JTable table = new JTable(model.table);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    JScrollPane scroll = new JScrollPane(table);
    JList rowHeader = new JList(model.list);
    rowHeader.setFixedCellHeight(table.getRowHeight());
    rowHeader.setCellRenderer(new RowHeaderRenderer(table));
    rowHeader.setBackground(table.getBackground());
    rowHeader.setOpaque(true);
    scroll.setRowHeaderView(rowHeader);
    return scroll;
}
 
Example #21
Source Project: marathonv5   Author: jalian-systems   File: DropDemo.java    License: Apache License 2.0 5 votes vote down vote up
private JPanel createList() {
    DefaultListModel listModel = new DefaultListModel();

    for (int i = 0; i < 10; i++) {
        listModel.addElement("List Item " + i);
    }

    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    JScrollPane scrollPane = new JScrollPane(list);
    scrollPane.setPreferredSize(new Dimension(400, 100));

    list.setDragEnabled(true);
    list.setTransferHandler(new ListTransferHandler());

    dropCombo = new JComboBox(new String[] { "USE_SELECTION", "ON", "INSERT", "ON_OR_INSERT" });
    dropCombo.addActionListener(this);
    JPanel dropPanel = new JPanel();
    dropPanel.add(new JLabel("List Drop Mode:"));
    dropPanel.add(dropCombo);

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(scrollPane, BorderLayout.CENTER);
    panel.add(dropPanel, BorderLayout.SOUTH);
    panel.setBorder(BorderFactory.createTitledBorder("List"));
    return panel;
}
 
Example #22
private void addAttributeTypeDefinitionStep() {
	JPanel content = new JPanel(new BorderLayout());
	JPanel textPanel = SwingTools
			.createTextPanel(
					"Please specify special attributes...",
					"Please specify special attribues if there are any. You can specify arbitrary special attributes in the Attribute Editor but in this Wizard only the most important types (label, id...) are supported.");
	content.add(textPanel, BorderLayout.NORTH);
	JScrollPane typeViewPane = new ExtendedJScrollPane(attributeTypeView);
	typeViewPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7),
			BorderFactory.createTitledBorder("Attribute Types")));
	content.add(typeViewPane, BorderLayout.CENTER);
	addStep(content);
}
 
Example #23
Source Project: TencentKona-8   Author: Tencent   File: HorizontalMouseWheelOnShiftPressed.java    License: GNU General Public License v2.0 5 votes vote down vote up
static void createAndShowGUI() {
    frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(300, 300);
    frame.setLocationRelativeTo(null);
    textArea = new JTextArea("Hello World!");
    scrollPane = new JScrollPane(textArea);
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(scrollPane, BorderLayout.CENTER);
    frame.getContentPane().add(panel);
    frame.setVisible(true);
}
 
Example #24
Source Project: Spark   Author: igniterealtime   File: MissedCalls.java    License: Apache License 2.0 5 votes vote down vote up
public JPanel getMissedCallPanel() {
    final JPanel panel = new JPanel(new GridBagLayout());
    panel.add(new JScrollPane(list), new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    callBackButton = new RolloverButton(PhoneRes.getIString("phone.callback"), PhoneRes.getImageIcon("PHONE_CALL_24x24_IMAGE"));
    deleteButton = new RolloverButton(PhoneRes.getIString("phone.delete"), PhoneRes.getImageIcon("DELETE_24x24_IMAGE"));
    callBackButton.setHorizontalAlignment(JLabel.CENTER);
    deleteButton.setHorizontalAlignment(JLabel.CENTER);
    final Font buttonFont = new Font("Dialog", Font.BOLD, 13);
    callBackButton.setFont(buttonFont);
    deleteButton.setFont(buttonFont);

    // Add Action Listener
    callBackButton.addActionListener(this);
    deleteButton.addActionListener(this);

    // Set as disabled by default, and only have them enabled if their is a valid
    // selection.
    callBackButton.setEnabled(false);
    deleteButton.setEnabled(false);

    final JPanel flowPanel = new JPanel(new FlowLayout());
    flowPanel.setOpaque(false);
    flowPanel.add(callBackButton);
    flowPanel.add(deleteButton);

    panel.setOpaque(false);
    panel.add(flowPanel, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    return panel;
}
 
Example #25
Source Project: marathonv5   Author: jalian-systems   File: PopupMenuDemoX.java    License: Apache License 2.0 5 votes vote down vote up
public Container createContentPane() {
    // Create the content-pane-to-be.
    JPanel contentPane = new JPanel(new BorderLayout());
    contentPane.setOpaque(true);

    // Create a scrolled text area.
    output = new JTextArea(5, 30);
    output.setEditable(false);
    scrollPane = new JScrollPane(output);

    // Add the text area to the content pane.
    contentPane.add(scrollPane, BorderLayout.CENTER);

    return contentPane;
}
 
Example #26
Source Project: netbeans   Author: apache   File: FileTreeView.java    License: Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "CTL_FileTree.treeColumn.Name=File"
})
public FileTreeView () {
    em = new ExplorerManager();
    view = new OutlineView(Bundle.CTL_FileTree_treeColumn_Name());
    view.getOutline().setShowHorizontalLines(true);
    view.getOutline().setShowVerticalLines(false);
    view.getOutline().setRootVisible(false);
    view.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    view.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    view.setPopupAllowed(false);
    view.getOutline().addMouseListener(this);
    view.getOutline().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ).put(
            KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK ), "org.openide.actions.PopupAction");
    view.getOutline().getActionMap().put("org.openide.actions.PopupAction", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            showPopup(org.netbeans.modules.versioning.util.Utils.getPositionForPopup(view.getOutline()));
        }
    });
    view.getOutline().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "slideOut");
    viewComponent = new ViewContainer(em);
    viewComponent.add(view, BorderLayout.CENTER);
    viewComponent.addAncestorListener(this);
    em.addPropertyChangeListener(this);
}
 
Example #27
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: GUIBrowser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void addReflectionTab() {
    methodTree = new JTree(compNode.getMethodsModel());
    methodTree.setCellRenderer(renderer);
    methodTree.setEditable(false);
    methodTree.addTreeSelectionListener(selManager);
    tbd.add(REFLECTION_TAB, new JScrollPane(methodTree));
}
 
Example #28
Source Project: nextreports-designer   Author: nextreports   File: DesignerTablePanel.java    License: Apache License 2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
            String expression = expressionColumn.getName();
//            String result = (String) JOptionPane.showInputDialog(Globals.getMainFrame(), null, "Expression",
//                    JOptionPane.QUESTION_MESSAGE, null, null, expression);

            final JTextArea textArea = new JTextArea(expression, 10, 30);
            textArea.setLineWrap(true);
            textArea.setWrapStyleWord(true);
            textArea.setEditable(true);

            Object msg[] = {"", new JScrollPane(textArea)};
//
            int option = JOptionPane.showOptionDialog(Globals.getMainFrame(),
                    msg, I18NSupport.getString("designer.expression"),
                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);

            if (option == JOptionPane.YES_OPTION) {
                String result = textArea.getText();
                if (expressionColumn instanceof ExpressionColumn) {
                    ((ExpressionColumn) expressionColumn).setExpression(result);
                } else if (expressionColumn instanceof GroupByFunctionColumn) {
                    ((GroupByFunctionColumn) expressionColumn).setExpression(result);
                }
                okPressed = true;
            }

            table.packAll();
        }
 
Example #29
Source Project: nextreports-designer   Author: nextreports   File: TableUtil.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creats a row header for the given table. The row number is displayed to
 * the left of the table ( starting with row 1).
 *
 * @param table       the table to create the row header for
 * @param headerWidth the number of characters to size the header
 */
public static TableRowHeader setRowHeader(JTable table, int headerWidth) {
    TableRowHeader result = null;
    Container p = table.getParent();
    if (p instanceof JViewport) {
        Container gp = p.getParent();
        if (gp instanceof JScrollPane) {
            JScrollPane scrollPane = (JScrollPane) gp;
            result = new TableRowHeader(table);
            scrollPane.setRowHeaderView(result);
        }
    }
    return result;
}
 
Example #30
Source Project: cstc   Author: usdAG   File: BurpEditorWrapper.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public Component getComponent() {
	if (fallbackMode) {
		JScrollPane inputScrollPane = new JScrollPane(fallbackArea);
		return inputScrollPane;
	}
	return burpEditor.getComponent();
}