类javax.swing.JScrollPane源码实例Demo

下面列出了怎么用javax.swing.JScrollPane的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: fosstrak-epcis   文件: QueryClientGui.java
/**
 * 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);
}
 
源代码2 项目: jdk8u_jdk   文件: XTextAreaPeer.java
@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;
    }
}
 
源代码3 项目: zap-extensions   文件: HighlighterPanel.java
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));
}
 
源代码4 项目: openjdk-jdk8u-backup   文件: XTextAreaPeer.java
@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;
    }
}
 
源代码5 项目: jdk8u-dev-jdk   文件: XTextAreaPeer.java
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);
                    }
                }
            }};
}
 
源代码6 项目: portmapper   文件: PortMapperView.java
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;
}
 
源代码7 项目: Spark   文件: ChatAreaSendField.java
/**
 * 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);
}
 
源代码8 项目: openjdk-jdk8u   文件: TreePosTest.java
/** 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) {
            }
        }
    });
}
 
源代码9 项目: netbeans   文件: AnalysisControllerUI.java
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);
}
 
源代码10 项目: hottub   文件: TableExample2.java
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);
}
 
源代码11 项目: ThingML-Tradfri   文件: BulbPanel.java
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);
    }
}
 
/**
    * 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);
}
 
源代码13 项目: spotbugs   文件: MainFrameComponentFactory.java
/**
 * 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;
}
 
源代码14 项目: netbeans   文件: ZoomManager.java
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);
}
 
源代码15 项目: RipplePower   文件: UIRes.java
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);
}
 
源代码16 项目: ramus   文件: PreviewView.java
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);
}
 
源代码17 项目: ramus   文件: ReportEditorTest.java
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));
    }

}
 
源代码18 项目: biojava   文件: MultipleAlignmentJmolDisplay.java
/**
 * 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);
}
 
源代码19 项目: rcrs-server   文件: ScoreTable.java
@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;
}
 
源代码20 项目: marathonv5   文件: DropDemo.java
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;
}
 
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);
}
 
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);
}
 
源代码23 项目: Spark   文件: MissedCalls.java
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;
}
 
源代码24 项目: marathonv5   文件: PopupMenuDemoX.java
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;
}
 
源代码25 项目: netbeans   文件: FileTreeView.java
@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);
}
 
源代码26 项目: gcs   文件: Outline.java
@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);
}
 
源代码27 项目: openjdk-jdk9   文件: GUIBrowser.java
private void addReflectionTab() {
    methodTree = new JTree(compNode.getMethodsModel());
    methodTree.setCellRenderer(renderer);
    methodTree.setEditable(false);
    methodTree.addTreeSelectionListener(selManager);
    tbd.add(REFLECTION_TAB, new JScrollPane(methodTree));
}
 
源代码28 项目: nextreports-designer   文件: DesignerTablePanel.java
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();
        }
 
源代码29 项目: nextreports-designer   文件: TableUtil.java
/**
 * 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;
}
 
源代码30 项目: cstc   文件: BurpEditorWrapper.java
@Override
public Component getComponent() {
	if (fallbackMode) {
		JScrollPane inputScrollPane = new JScrollPane(fallbackArea);
		return inputScrollPane;
	}
	return burpEditor.getComponent();
}
 
 类所在包
 同包方法