当前位置: 首页>>代码示例>>Java>>正文


Java JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED属性代码示例

本文整理汇总了Java中javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED属性的典型用法代码示例。如果您正苦于以下问题:Java JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED属性的具体用法?Java JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED怎么用?Java JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.swing.JScrollPane的用法示例。


在下文中一共展示了JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ImagePicker

public ImagePicker() {
  noImage = new JTextArea(1,10);
  noImage.setFont(FONT);
  noImage.setText("Double-click here to add new image");
  noImage.addMouseListener(this);
  noImage.setEditable(false);
  noImage.setLineWrap(true);
  noImage.setWrapStyleWord(true);
  noImage.setMinimumSize(new Dimension(15, 32));
  icon = new OpIcon();
  imageView = new JLabel(icon);
  imageView.addMouseListener(this);

  imageViewer = new JPanel(new BorderLayout());
  imageScroller = new ScrollPane(
    imageView,
    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  imageViewer.add(imageScroller, BorderLayout.CENTER);

  select = new JComboBox(ArrayUtils.prepend(GameModule.getGameModule().getDataArchive().getImageNames(), NO_IMAGE));
  select.addItemListener(this);
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  add(noImage);
  add(select);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:26,代码来源:ImagePicker.java

示例2: QueryResultViewer

public QueryResultViewer() {
	resultSet = null;
	tableModel = new DefaultTableModel();
	emptyResultLabel = new JLabel(EMPTY_RESULT_MSG);
	mainContainer = new JPanel();
	
	setLayout(new BorderLayout());
	tableSP = new JScrollPane(graphicTable,
			JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, 
			JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	tableSP.setBorder(BorderFactory.createEmptyBorder());
	
	graphicTable.setModel(tableModel);
	graphicTable.setFillsViewportHeight(true);
	graphicTable.setEnabled(false);
	
	addComponentListener(new ComponentAdapter() {
	    public void componentResized(ComponentEvent e) {
	        resizeColumnWidth(COL_MIN_WIDTH);          
	    }
	});
	
	mainContainer.add(tableSP);
	setLayout(new GridLayout(1,1));
	add(tableSP);
}
 
开发者ID:tteguayco,项目名称:JITRAX,代码行数:26,代码来源:QueryResultViewer.java

示例3: initComponents

private void initComponents() {
    resultsArea = new HTMLTextArea() {
        protected void showURL(URL url) {
            resultsController.showURL(url);
        }
    };

    JScrollPane resultsAreaScroll = new JScrollPane(resultsArea,
                            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    resultsAreaScroll.setBorder(BorderFactory.createMatteBorder(5, 5, 5, 5,
                                    UIUtils.getProfilerResultsBackground()));
    resultsAreaScroll.setViewportBorder(BorderFactory.createEmptyBorder());
    resultsAreaScroll.getVerticalScrollBar().setUnitIncrement(10);
    resultsAreaScroll.getHorizontalScrollBar().setUnitIncrement(10);

    JPanel contentsPanel = new JPanel();
    contentsPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, getTitleBorderColor()));
    contentsPanel.setLayout(new BorderLayout());
    contentsPanel.setOpaque(true);
    contentsPanel.setBackground(resultsArea.getBackground());
    contentsPanel.add(resultsAreaScroll, BorderLayout.CENTER);

    setLayout(new BorderLayout());
    add(contentsPanel, BorderLayout.CENTER);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:OQLControllerUI.java

示例4: initComponents

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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:AnalysisControllerUI.java

示例5: MapEditorTransformPanel

/**
 * Creates a panel to choose a map transform.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public MapEditorTransformPanel(FreeColClient freeColClient) {
    super(freeColClient, new BorderLayout());

    nativeNation = first(getSpecification().getIndianNations());

    listPanel = new JPanel(new GridLayout(2, 0));

    group = new ButtonGroup();
    //Add an invisible, move button to de-select all others
    group.add(new JToggleButton());
    buildList();

    JScrollPane sl = new JScrollPane(listPanel,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    sl.getViewport().setOpaque(false);
    add(sl);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:23,代码来源:MapEditorTransformPanel.java

示例6: initComponents

private void initComponents() {
    setLayout(new BorderLayout());

    JPanel contentsPanel = new JPanel(new BorderLayout());
    contentsPanel.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.setOpaque(true);
    contentsPanel.setBorder(BorderFactory.createMatteBorder(0, 15, 15, 15, UIUtils.getProfilerResultsBackground()));

    headerArea = new HTMLTextArea() {
            protected void showURL(URL url) {
                String urlString = url.toString();

                if (START_LOCATION_URLMASK.equals(urlString)) {
                    Utils.openLocation(StopwatchProfilingPoint.this.getStartLocation());
                } else if (StopwatchProfilingPoint.this.usesEndLocation()) {
                    Utils.openLocation(StopwatchProfilingPoint.this.getEndLocation());
                }
            }
        };

    JScrollPane headerAreaScrollPane = new JScrollPane(headerArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                       JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    headerAreaScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 15, 0, UIUtils.getProfilerResultsBackground()));
    headerAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    contentsPanel.add(headerAreaScrollPane, BorderLayout.NORTH);

    dataArea = new HTMLTextArea();

    JScrollPane dataAreaScrollPane = new JScrollPane(dataArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TitledBorder tb = new TitledBorder(Bundle.StopwatchProfilingPoint_DataString());
    tb.setTitleFont(Utils.getTitledBorderFont(tb).deriveFont(Font.BOLD));
    tb.setTitleColor(javax.swing.UIManager.getColor("Label.foreground")); // NOI18N
    dataAreaScrollPane.setBorder(tb);
    dataAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    dataAreaScrollPane.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.add(dataAreaScrollPane, BorderLayout.CENTER);

    add(contentsPanel, BorderLayout.CENTER);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:StopwatchProfilingPoint.java

示例7: WarehouseDialog

/**
 * Creates a dialog to display the warehouse.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 * @param colony The {@code Colony} containing the warehouse.
 */
public WarehouseDialog(FreeColClient freeColClient, JFrame frame,
        Colony colony) {
    super(freeColClient, frame);

    warehousePanel = new MigPanel(new MigLayout("wrap 4"));
    warehousePanel.setOpaque(false);
    for (GoodsType type : freeColClient.getGame().getSpecification()
             .getStorableGoodsTypeList()) {
        warehousePanel.add(new WarehouseGoodsPanel(freeColClient,
                                                   colony, type));
    }

    JScrollPane scrollPane = new JScrollPane(warehousePanel,
        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.getVerticalScrollBar().setUnitIncrement(16);
    scrollPane.getViewport().setOpaque(false);
    scrollPane.setBorder(null);

    MigPanel panel = new MigPanel(new MigLayout("fill, wrap 1", "", ""));
    panel.add(Utility.localizedHeader(Messages.nameKey("warehouseDialog"), false),
              "align center");
    panel.add(scrollPane, "grow");
    panel.setSize(panel.getPreferredSize());

    ImageIcon icon = new ImageIcon(
        getImageLibrary().getSmallSettlementImage(colony));
    initializeConfirmDialog(frame, true, panel, icon, "ok", "cancel");
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:36,代码来源:WarehouseDialog.java

示例8: initComponents

private void initComponents() {
    setLayout(new BorderLayout());

    JPanel contentsPanel = new JPanel(new BorderLayout());
    contentsPanel.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.setOpaque(true);
    contentsPanel.setBorder(BorderFactory.createMatteBorder(0, 15, 15, 15, UIUtils.getProfilerResultsBackground()));

    headerArea = new HTMLTextArea() {
            protected void showURL(URL url) {
                String urlString = url.toString();

                if (START_LOCATION_URLMASK.equals(urlString)) {
                    Utils.openLocation(LoadGenProfilingPoint.this.getStartLocation());
                } else if (LoadGenProfilingPoint.this.usesEndLocation()) {
                    Utils.openLocation(LoadGenProfilingPoint.this.getEndLocation());
                }
            }
        };

    JScrollPane headerAreaScrollPane = new JScrollPane(headerArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                       JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    headerAreaScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 15, 0, UIUtils.getProfilerResultsBackground()));
    headerAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    contentsPanel.add(headerAreaScrollPane, BorderLayout.NORTH);

    dataArea = new HTMLTextArea();

    JScrollPane dataAreaScrollPane = new JScrollPane(dataArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TitledBorder tb = new TitledBorder(Bundle.LoadGenProfilingPoint_DataString());
    tb.setTitleFont(Utils.getTitledBorderFont(tb).deriveFont(Font.BOLD));
    tb.setTitleColor(javax.swing.UIManager.getColor("Label.foreground")); // NOI18N
    dataAreaScrollPane.setBorder(tb);
    dataAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    dataAreaScrollPane.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.add(dataAreaScrollPane, BorderLayout.CENTER);

    add(contentsPanel, BorderLayout.CENTER);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:LoadGenProfilingPoint.java

示例9: ColopediaPanel

/**
 * The constructor that will add the items to this panel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param id The object identifier of the item to select.
 */
public ColopediaPanel(FreeColClient freeColClient, String id) {
    super(freeColClient, new MigLayout("fill", 
            "[200:]unrelated[550:, grow, fill]", "[][grow, fill][]"));

    add(Utility.localizedHeader("colopedia", false),
        "span, align center");

    listPanel = new MigPanel("ColopediaPanelUI");
    listPanel.setOpaque(true);
    JScrollPane sl = new JScrollPane(listPanel,
                                     JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    sl.getVerticalScrollBar().setUnitIncrement(16);
    sl.getViewport().setOpaque(false);
    add(sl);

    detailPanel = new MigPanel("ColopediaPanelUI");
    detailPanel.setOpaque(true);
    JScrollPane detail = new JScrollPane(detailPanel,
                                         JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                         JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    detail.getVerticalScrollBar().setUnitIncrement(16);
    detail.getViewport().setOpaque(false);
    add(detail, "grow");

    add(okButton, "newline 20, span, tag ok");

    float scale = getImageLibrary().getScaleFactor();
    getGUI().restoreSavedSize(this, 200 + (int)(scale*850), 200 + (int)(scale*525));
    tree = buildTree();

    select(id);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:39,代码来源:ColopediaPanel.java

示例10: getTextComponent

/** Helper method returns a JTextArea containing the given text. */
private JComponent getTextComponent(String text) {
	final JTextArea ta = OurUtil.textarea(text, 10, 10, false, true);
	final JScrollPane ans = new JScrollPane(ta, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
			JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) {
		private static final long serialVersionUID = 0;

		@Override
		public void setFont(Font font) {
			ta.setFont(font);
		}
	};
	ans.setBorder(new OurBorder(true, false, true, false));
	return ans;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:15,代码来源:VizGUI.java

示例11: StatisticsPanel

/**
 * Creates the statistics panel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param serverStatistics A map of key,value pairs of server statistics.
 * @param clientStatistics A map of key,value pairs of client statistics.
 */
public StatisticsPanel(FreeColClient freeColClient,
                       Map<String, String> serverStatistics,
                       Map<String, String> clientStatistics) {
    super(freeColClient, new BorderLayout());

    // Title
    JPanel header = new JPanel();
    this.add(header, BorderLayout.PAGE_START);
    header.add(Utility.localizedLabel("statistics"), JPanel.CENTER_ALIGNMENT);

    // Actual stats panel
    JPanel statsPanel = new JPanel(new GridLayout(1,2));
    JScrollPane scrollPane = new JScrollPane(statsPanel,
        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    // correct way to make scroll pane opaque
    scrollPane.getViewport().setOpaque(false);
    scrollPane.setBorder(null);

    this.add(scrollPane,BorderLayout.CENTER);
    statsPanel.add(displayStatsMessage("client", clientStatistics));
    statsPanel.add(displayStatsMessage("server", serverStatistics));

    add(okButton, BorderLayout.PAGE_END);

    setSize(getPreferredSize());
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:34,代码来源:StatisticsPanel.java

示例12: initComponents

private void initComponents() {
    setLayout(new BorderLayout());

    JPanel contentsPanel = new JPanel(new BorderLayout());
    contentsPanel.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.setOpaque(true);
    contentsPanel.setBorder(BorderFactory.createMatteBorder(0, 15, 15, 15, UIUtils.getProfilerResultsBackground()));

    headerArea = new HTMLTextArea();

    JScrollPane headerAreaScrollPane = new JScrollPane(headerArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                       JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    headerAreaScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 15, 0, UIUtils.getProfilerResultsBackground()));
    headerAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    contentsPanel.add(headerAreaScrollPane, BorderLayout.NORTH);

    dataArea = new HTMLTextArea() {
            protected void showURL(URL url) {
                File resolvedFile = null;

                try {
                    resolvedFile = new File(url.toURI());
                } catch (URISyntaxException ex) {
                    ex.printStackTrace();
                }

                final File snapshotFile = resolvedFile;

                if ((snapshotFile != null) && snapshotFile.exists()) {
                    String type = TimedTakeSnapshotProfilingPoint.this.getSnapshotType();
                    if (type.equals(TYPE_PROFDATA_KEY) || type.equals(TYPE_HEAPDUMP_KEY)) {
                        ResultsManager.getDefault().openSnapshot(snapshotFile);
                    }
                } else {
                    ProfilerDialogs.displayWarning(
                            Bundle.TimedTakeSnapshotProfilingPoint_SnapshotNotAvailableMsg());
                }
            }
        };

    JScrollPane dataAreaScrollPane = new JScrollPane(dataArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TitledBorder tb = new TitledBorder(Bundle.TimedTakeSnapshotProfilingPoint_DataString());
    tb.setTitleFont(Utils.getTitledBorderFont(tb).deriveFont(Font.BOLD));
    tb.setTitleColor(javax.swing.UIManager.getColor("Label.foreground")); // NOI18N
    dataAreaScrollPane.setBorder(tb);
    dataAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    dataAreaScrollPane.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.add(dataAreaScrollPane, BorderLayout.CENTER);

    add(contentsPanel, BorderLayout.CENTER);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:52,代码来源:TimedTakeSnapshotProfilingPoint.java

示例13: initComponents

private void initComponents() {
    setLayout(new BorderLayout());

    JPanel contentsPanel = new JPanel(new BorderLayout());
    contentsPanel.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.setOpaque(true);
    contentsPanel.setBorder(BorderFactory.createMatteBorder(0, 15, 15, 15, UIUtils.getProfilerResultsBackground()));

    headerArea = new HTMLTextArea() {
            protected void showURL(URL url) {
                Utils.openLocation(TakeSnapshotProfilingPoint.this.getLocation());
            }
        };

    JScrollPane headerAreaScrollPane = new JScrollPane(headerArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                       JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    headerAreaScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 15, 0, UIUtils.getProfilerResultsBackground()));
    headerAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    contentsPanel.add(headerAreaScrollPane, BorderLayout.NORTH);

    dataArea = new HTMLTextArea() {
            protected void showURL(URL url) {
                File resolvedFile = null;

                try {
                    resolvedFile = new File(url.toURI());
                } catch (URISyntaxException ex) {
                    ex.printStackTrace();
                }

                final File snapshotFile = resolvedFile;

                if ((snapshotFile != null) && snapshotFile.exists()) {
                    String type = TakeSnapshotProfilingPoint.this.getSnapshotType();
                    if (type.equals(TYPE_PROFDATA_KEY) || type.equals(TYPE_HEAPDUMP_KEY)) {
                        ResultsManager.getDefault().openSnapshot(snapshotFile);
                    }
                } else {
                    ProfilerDialogs.displayWarning(
                            Bundle.TakeSnapshotProfilingPoint_SnapshotNotAvailableMsg());
                }
            }
        };

    JScrollPane dataAreaScrollPane = new JScrollPane(dataArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TitledBorder tb = new TitledBorder(Bundle.TakeSnapshotProfilingPoint_DataString());
    tb.setTitleFont(Utils.getTitledBorderFont(tb).deriveFont(Font.BOLD));
    tb.setTitleColor(javax.swing.UIManager.getColor("Label.foreground")); // NOI18N
    dataAreaScrollPane.setBorder(tb);
    dataAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    dataAreaScrollPane.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.add(dataAreaScrollPane, BorderLayout.CENTER);

    add(contentsPanel, BorderLayout.CENTER);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:56,代码来源:TakeSnapshotProfilingPoint.java

示例14: initComponents

private void initComponents() {
    setLayout(new BorderLayout());

    JPanel contentsPanel = new JPanel(new BorderLayout());
    contentsPanel.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.setOpaque(true);
    contentsPanel.setBorder(BorderFactory.createMatteBorder(0, 15, 15, 15, UIUtils.getProfilerResultsBackground()));

    headerArea = new HTMLTextArea();

    JScrollPane headerAreaScrollPane = new JScrollPane(headerArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                       JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    headerAreaScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 15, 0, UIUtils.getProfilerResultsBackground()));
    headerAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    contentsPanel.add(headerAreaScrollPane, BorderLayout.NORTH);

    dataArea = new HTMLTextArea() {
            protected void showURL(URL url) {
                File resolvedFile = null;

                try {
                    resolvedFile = new File(url.toURI());
                } catch (URISyntaxException ex) {
                    ex.printStackTrace();
                }

                final File snapshotFile = resolvedFile;

                if ((snapshotFile != null) && snapshotFile.exists()) {
                    String type = TriggeredTakeSnapshotProfilingPoint.this.getSnapshotType();
                    if (type.equals(TYPE_PROFDATA_KEY) || type.equals(TYPE_HEAPDUMP_KEY)) {
                        ResultsManager.getDefault().openSnapshot(snapshotFile);
                    }
                } else {
                    ProfilerDialogs.displayWarning(
                            Bundle.TriggeredTakeSnapshotProfilingPoint_SnapshotNotAvailableMsg());
                }
            }
        };

    JScrollPane dataAreaScrollPane = new JScrollPane(dataArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TitledBorder tb = new TitledBorder(Bundle.TriggeredTakeSnapshotProfilingPoint_DataString());
    tb.setTitleFont(Utils.getTitledBorderFont(tb).deriveFont(Font.BOLD));
    tb.setTitleColor(javax.swing.UIManager.getColor("Label.foreground")); // NOI18N
    dataAreaScrollPane.setBorder(tb);
    dataAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    dataAreaScrollPane.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.add(dataAreaScrollPane, BorderLayout.CENTER);

    add(contentsPanel, BorderLayout.CENTER);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:52,代码来源:TriggeredTakeSnapshotProfilingPoint.java

示例15: FeaturesView

public FeaturesView(Component defaultView, String buttonString) {
    if (UIUtils.isOracleLookAndFeel()) {
        setOpaque(true);
        setBackground(UIUtils.getProfilerResultsBackground());
    } else {
        setOpaque(false);
    }
    setBorder(BorderFactory.createEmptyBorder());
    setLayout(new BorderLayout(0, 0));
    
    if (defaultView != null) {
        JScrollPane sp = new JScrollPane(defaultView, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) {
            public Dimension getMinimumSize() { return getPreferredSize(); }
        };
        sp.getVerticalScrollBar().setUnitIncrement(20);
        sp.setBorder(null);
        sp.setViewportBorder(null);

        this.defaultView = sp;
        add(this.defaultView, BorderLayout.CENTER);
    } else {
        this.defaultView = null;
    }
    
    if (buttonString != null) {
        hintLabel = new JLabel();
        hintLabel.setIcon(Icons.getIcon(GeneralIcons.INFO));
        hintLabel.setIconTextGap(hintLabel.getIconTextGap() + 1);
        hintLabel.setOpaque(false);
        
        Font font = new JToolTip().getFont();
        
        Color f = hintLabel.getForeground();
        int r = f.getRed() + 70;
        if (r > 255) r = f.getRed() - 70; else r = Math.min(r, 70);
        int g = f.getGreen() + 70;
        if (g > 255) g = f.getRed() - 70; else g = Math.min(g, 70);
        int b = f.getBlue() + 70;
        if (b > 255) b = f.getRed() - 70; else b = Math.min(b, 70);
        hintLabel.setText("<html><body text=\"rgb(" + r + ", " + g + ", " + b + ")\" style=\"font-size: " + //NOI18N
                          (font.getSize()) + "pt; font-family: " + font.getName() + ";\">" + //NOI18N
                          Bundle.FeaturesView_noData("<b>" + buttonString + "</b>") + "</body></html>"); //NOI18N
        
        hintLabel.setSize(hintLabel.getPreferredSize());
        
        Color c = UIUtils.getProfilerResultsBackground();
        hintColor = Utils.checkedColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 245));
    } else {
        hintColor = null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:51,代码来源:FeaturesView.java


注:本文中的javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。