javax.swing.JScrollPane#setBackground ( )源码实例Demo

下面列出了javax.swing.JScrollPane#setBackground ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: 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);
}
 
源代码2 项目: jdk8u-dev-jdk   文件: XTextAreaPeer.java
@Override
protected void installDefaults(JScrollPane scrollpane) {
    Border b = scrollpane.getBorder();
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    scrollpane.setBorder(uidefaults.getBorder("ScrollPane.border"));
    scrollpane.setBackground(uidefaults.getColor("ScrollPane.background"));
    scrollpane.setViewportBorder(uidefaults.getBorder("TextField.border"));
    JScrollBar vsb = scrollpane.getVerticalScrollBar();
    if (vsb != null) {
        if (isLeftToRight(scrollpane)) {
            vsbBorder = new CompoundBorder(vsbMarginBorderR,
                                           vsb.getBorder());
        }
        else {
            vsbBorder = new CompoundBorder(vsbMarginBorderL,
                                           vsb.getBorder());
        }
        vsb.setBorder(vsbBorder);
    }

    JScrollBar hsb = scrollpane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbBorder = new CompoundBorder(hsbMarginBorder, hsb.getBorder());
        hsb.setBorder(hsbBorder);
    }
}
 
源代码3 项目: Open-Realms-of-Stars   文件: EspionagePanel.java
/**
 * Constructor for espionage panel. Contains title,
 * espionage value and description info text
 * @param realm Realm name to show
 * @param text Espionage text
 * @param espionageValue Espionage value
 * @param relation Realm relation text
 * @param relationColor what color is used to draw relation text.
 * @param listener ActionListener for showing realm information button.
 */
public EspionagePanel(final String realm, final String text,
    final int espionageValue, final String relation,
    final Color relationColor, final ActionListener listener) {
  realmName = realm;
  description = text;
  value = espionageValue;
  this.setTitle(realmName);
  this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
  IconLabel iconLabel = new IconLabel(null,
      Icons.getIconByName(Icons.ICON_SPY_GOGGLES), "Espionage: "
      + value + "/10");
  this.add(iconLabel);
  SpaceLabel likenessLabel = new SpaceLabel(relation);
  likenessLabel.setForeground(relationColor);
  this.add(likenessLabel);
  this.add(Box.createRigidArea(new Dimension(5, 5)));
  InfoTextArea infoText = new InfoTextArea();
  infoText.setEditable(false);
  infoText.setFont(GuiStatics.getFontCubellanSmaller());
  infoText.setCharacterWidth(8);
  infoText.setLineWrap(true);
  JScrollPane scroll = new JScrollPane(infoText);
  scroll.setBackground(GuiStatics.COLOR_DEEP_SPACE_PURPLE_DARK);
  infoText.setText(description);
  this.add(scroll);
  this.add(Box.createRigidArea(new Dimension(5, 5)));
  SpaceButton btn = new SpaceButton("Realm", realmName + "|"
      + GameCommands.COMMAND_REALM_VIEW);
  btn.addActionListener(listener);
  this.add(btn);
}
 
源代码4 项目: netbeans   文件: ResetResultsProfilingPoint.java
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(ResetResultsProfilingPoint.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();

    JScrollPane dataAreaScrollPane = new JScrollPane(dataArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TitledBorder tb = new TitledBorder(Bundle.ResetResultsProfilingPoint_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);
}
 
public AssociationRuleTableViewer(AssociationRules rules) {
	if (rules != null && rules.getNumberOfRules() > 0) {
		this.model = new AssociationRuleTableModel(rules);
		setLayout(new BorderLayout());
		JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
		splitPane.setBorder(null);

		// conclusion list
		AssociationRuleFilter filter = new AssociationRuleFilter(rules);
		filter.addAssociationRuleFilterListener(this);
		filter.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 5));
		splitPane.add(filter, 0);

		// main panel
		{
			JPanel mainPanel = new JPanel();
			mainPanel.setOpaque(true);
			mainPanel.setBackground(Colors.WHITE);
			GridBagLayout layout = new GridBagLayout();
			mainPanel.setLayout(layout);
			GridBagConstraints c = new GridBagConstraints();
			c.fill = GridBagConstraints.BOTH;
			c.weightx = 1;
			c.weighty = 1;
			c.gridwidth = GridBagConstraints.REMAINDER;
			c.insets = new Insets(15, 10, 10, 10);

			table.setModel(model);
			table.setRowHeight(PropertyPanel.VALUE_CELL_EDITOR_HEIGHT);
			table.setRowHighlighting(true);
			table.setAutoResizeMode(ExtendedJTable.AUTO_RESIZE_OFF);
			JScrollPane tablePane = new ExtendedJScrollPane(table);
			tablePane.setBorder(null);
			tablePane.setBackground(Colors.WHITE);
			tablePane.getViewport().setBackground(Colors.WHITE);
			layout.setConstraints(tablePane, c);
			mainPanel.add(tablePane);

			setColumnSizes();

			splitPane.add(mainPanel, 1);
			table.getTableHeader().setBackground(Colors.WHITE);
			table.getTableHeader().putClientProperty(RapidLookTools.PROPERTY_TABLE_HEADER_BACKGROUND, Colors.WHITE);
		}
		filter.triggerFilter();

		add(splitPane, BorderLayout.CENTER);
	} else {
		add(ResultDisplayTools.createErrorComponent("No rules found"), BorderLayout.CENTER);
	}
}
 
源代码6 项目: jdk8u-jdk   文件: MetalworksInBox.java
public MetalworksInBox() {
    super("In Box", true, true, true, true);

    DefaultMutableTreeNode unread;
    DefaultMutableTreeNode personal;
    DefaultMutableTreeNode business;
    DefaultMutableTreeNode spam;

    DefaultMutableTreeNode top = new DefaultMutableTreeNode("Mail Boxes");

    top.add(unread = new DefaultMutableTreeNode("Unread Mail"));
    top.add(personal = new DefaultMutableTreeNode("Personal"));
    top.add(business = new DefaultMutableTreeNode("Business"));
    top.add(spam = new DefaultMutableTreeNode("Spam"));

    unread.add(new DefaultMutableTreeNode("Buy Stuff Now"));
    unread.add(new DefaultMutableTreeNode("Read Me Now"));
    unread.add(new DefaultMutableTreeNode("Hot Offer"));
    unread.add(new DefaultMutableTreeNode("Re: Re: Thank You"));
    unread.add(new DefaultMutableTreeNode("Fwd: Good Joke"));

    personal.add(new DefaultMutableTreeNode("Hi"));
    personal.add(new DefaultMutableTreeNode("Good to hear from you"));
    personal.add(new DefaultMutableTreeNode("Re: Thank You"));

    business.add(new DefaultMutableTreeNode("Thanks for your order"));
    business.add(new DefaultMutableTreeNode("Price Quote"));
    business.add(new DefaultMutableTreeNode("Here is the invoice"));
    business.add(new DefaultMutableTreeNode(
            "Project Metal: delivered on time"));
    business.add(new DefaultMutableTreeNode("Your salary raise approved"));

    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Make $$$ Now"));
    spam.add(new DefaultMutableTreeNode("HOT HOT HOT"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Don't Miss This"));
    spam.add(new DefaultMutableTreeNode("Opportunity in Precious Metals"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Last Chance"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Make $$$ Now"));
    spam.add(new DefaultMutableTreeNode("To Hot To Handle"));
    spam.add(new DefaultMutableTreeNode("I'm waiting for your call"));

    JTree tree = new JTree(top);
    JScrollPane treeScroller = new JScrollPane(tree);
    treeScroller.setBackground(tree.getBackground());
    setContentPane(treeScroller);
    setSize(325, 200);
    setLocation(75, 75);

}
 
源代码7 项目: PacketProxy   文件: GUIFilterConfig.java
private JComponent createComponent() {
	String[] menu = { "#", I18nString.get("Filter name"), I18nString.get("Filter") };
	int[] menu_width = { 40, 150, 610 };
	boolean[] fixed_map = { true, false, false };
	int[] align_map = { JLabel.RIGHT, JLabel.LEFT, JLabel.LEFT };
	project_model = new ProjectTableModel(menu, 0) {
		private static final long serialVersionUID = 1L;
		@Override
		public boolean isCellEditable(int row, int column) { return false; }
	};
	JPanel panel = new JPanel();

	table = new JTable(project_model);
	tableFixedColumnWidth(table, menu_width, fixed_map);
	tableAssignAlignment(table, align_map);
	//sorter = new TableRowSorter<ProjectTableModel>(project_model);
	//table.setRowSorter(sorter);
	for (int i = 0; i < menu.length; i++) {
		table.getColumn(menu[i]).setPreferredWidth(menu_width[i]);
	}
	((JComponent) table.getDefaultRenderer(Boolean.class)).setOpaque(true);

	JScrollPane scrollpane1 = new JScrollPane(table);
    scrollpane1.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
    scrollpane1.setBackground(Color.WHITE);

	panel.add(createTableButton());
	panel.add(scrollpane1);
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    panel.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
    panel.setBackground(Color.WHITE);
	panel.add(scrollpane1);
	
	//sort_field = new HintTextField("フィルタ文字列");
    //sort_field.getDocument().addDocumentListener(new DocumentListener() {
	//	@Override
	//	public void insertUpdate(DocumentEvent e) {
	//		sortByText(sort_field.getText());
	//	}
	//	@Override
	//	public void removeUpdate(DocumentEvent e) {
	//		sortByText(sort_field.getText());
	//	}
	//	@Override
	//	public void changedUpdate(DocumentEvent e) {
	//		sortByText(sort_field.getText());
	//	}
    //});
    //sort_field.setMaximumSize(new Dimension(Short.MAX_VALUE, sort_field.getPreferredSize().height));
    
    JPanel vpanel = new JPanel();
    vpanel.setLayout(new BoxLayout(vpanel, BoxLayout.Y_AXIS));
    vpanel.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
    //vpanel.add(sort_field);
    vpanel.add(panel);
	
	return vpanel;
}
 
源代码8 项目: rapidminer-studio   文件: DataTableViewer.java
public DataTableViewer(DataTable dataTable, LinkedHashMap<String, Class<? extends Plotter>> availablePlotters,
		boolean showPlotter, String tableMode, boolean autoResize) {
	super(new BorderLayout());

	// create empty buttonCard
	ButtonBarCardPanel bCard = new ButtonBarCardPanel();

	// Build table view
	this.dataTableViewerTable = new DataTableViewerTable(autoResize);
	this.tablePanel = new JPanel(new BorderLayout());
	JPanel infoPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
	infoPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 5));
	infoPanel.add(generalInfo);
	infoPanel.setOpaque(true);
	infoPanel.setBackground(Colors.WHITE);
	tablePanel.add(infoPanel, BorderLayout.NORTH);
	JScrollPane tableScrollPane = new ExtendedJScrollPane(dataTableViewerTable);
	tableScrollPane.setBorder(BorderFactory.createEmptyBorder(1, 10, 10, 5));
	tableScrollPane.setBackground(Colors.WHITE);
	tableScrollPane.getViewport().setBackground(Colors.WHITE);
	tablePanel.add(tableScrollPane, BorderLayout.CENTER);

	// add data table to the result view
	bCard.addCard(new ResourceCard("data_view", "result_view.data_view"), tablePanel);

	// Add plotters if desired
	if (showPlotter) {
		this.plotterSettings = new PlotterConfigurationModel(availablePlotters, dataTable);
		this.plotterPanel = new PlotterPanel(plotterSettings);
		DataTable plotData = plotterSettings.getDataTable();

		// preface to create ChartConfigationPanel:
		ExampleSet exampleSet = DataTableExampleSetAdapter.createExampleSetFromDataTable(plotData);
		Map<DatasetTransformationType, PlotConfiguration> plotConfigurationMap = PlotConfigurationHistory
				.getPlotConfigurationMap(exampleSet, plotData);
		PlotInstance plotInstance = new PlotInstance(plotConfigurationMap.get(DatasetTransformationType.ORIGINAL),
				plotData);
		this.advancedPanel = new ChartConfigurationPanel(true, plotInstance, plotData,
				plotConfigurationMap.get(DatasetTransformationType.DE_PIVOTED));

		// add Plotter to the result view
		bCard.addCard(new ResourceCard("plot_view", "result_view.plot_view"), plotterPanel);

		// add advanced Charts to the result view
		bCard.addCard(new ResourceCard("advanced_charts", "result_view.advanced_charts"), advancedPanel);
	} // end if (showPlotter)

	// check select desired view
	if (PLOT_MODE.equals(tableMode) && showPlotter) {
		bCard.selectCard("plot_view");
	} else if (ADVANCED_MODE.equals(tableMode) && showPlotter) {
		bCard.selectCard("advanced_charts");
	}

	add(bCard, BorderLayout.CENTER);
	setDataTable(dataTable);
}
 
源代码9 项目: TencentKona-8   文件: DiagramScene.java
public DiagramScene(Action[] actions, DiagramViewModel model) {
    this.actions = actions;
    selectedWidgets = new ArrayList<FigureWidget>();
    content = new InstanceContent();
    lookup = new AbstractLookup(content);
    this.setCheckClipping(true);
    this.getInputBindings().setZoomActionModifiers(0);

    JComponent comp = this.createView();
    comp.setDoubleBuffered(true);
    comp.setBackground(Color.WHITE);
    comp.setOpaque(true);

    this.setBackground(Color.WHITE);
    this.setOpaque(true);
    scrollPane = new JScrollPane(comp);
    scrollPane.setBackground(Color.WHITE);
    scrollPane.getVerticalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getVerticalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getHorizontalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getHorizontalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getViewport().addChangeListener(scrollChangeListener);
    hoverAction = this.createWidgetHoverAction();

    blockLayer = new LayerWidget(this);
    this.addChild(blockLayer);

    startLayer = new LayerWidget(this);
    this.addChild(startLayer);
    // TODO: String startLabelString = "Loading graph with " + originalDiagram.getFigures().size() + " figures and " + originalDiagram.getConnections().size() + " connections...";
    String startLabelString = "";
    LabelWidget w = new LabelWidget(this, startLabelString);
    scrollChangeListener.register(w, new Point(10, 10));
    w.setAlignment(LabelWidget.Alignment.CENTER);
    startLabel = w;
    startLayer.addChild(w);

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    topLeft = new Widget(this);
    topLeft.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(topLeft);


    bottomRight = new Widget(this);
    bottomRight.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(bottomRight);

    slotLayer = new LayerWidget(this);
    this.addChild(slotLayer);

    connectionLayer = new LayerWidget(this);
    this.addChild(connectionLayer);

    LayerWidget selectionLayer = new LayerWidget(this);
    this.addChild(selectionLayer);

    this.setLayout(LayoutFactory.createAbsoluteLayout());

    this.getActions().addAction(hoverAction);
    zoomAction = new BoundedZoomAction(1.1, false);
    zoomAction.setMaxFactor(ZOOM_MAX_FACTOR);
    zoomAction.setMinFactor(ZOOM_MIN_FACTOR);
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
    panAction = new ExtendedPanAction();
    this.getActions().addAction(panAction);
    this.getActions().addAction(ActionFactory.createPopupMenuAction(popupMenuProvider));

    LayerWidget selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(rectangularSelectDecorator, selectLayer, rectangularSelectProvider));

    blockWidgets = new HashMap<InputBlock, BlockWidget>();

    boolean b = this.getUndoRedoEnabled();
    this.setUndoRedoEnabled(false);
    this.setNewModel(model);
    this.setUndoRedoEnabled(b);
}
 
源代码10 项目: Open-Realms-of-Stars   文件: EspionageView.java
/**
 * Espionage View constructor
 * @param playerList List of all players
 * @param info PlayerInfo who is doing the spying
 * @param militaryNews Galaxy news about military stats
 * @param listener Action Listener
 */
public EspionageView(final PlayerList playerList, final PlayerInfo info,
    final GalaxyStat militaryNews, final ActionListener listener) {
  player = info;
  this.setLayout(new BorderLayout());

  InfoPanel topPanel = new InfoPanel();
  topPanel.setTitle("Faking the military size for GBNC");
  topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
  fakeMilitarySlider = new SpaceSliderPanel(
      GameCommands.COMMAND_MINUS_MILITARY,
      GameCommands.COMMAND_PLUS_MILITARY, Icons.ICON_TROOPS,
      "Lie military size (100%)", 50, 200, info.getFakeMilitarySize(),
      GameCommands.COMMAND_FAKE_MILITARY, listener);
  fakeMilitarySlider.setSliderMinorTick(10);
  fakeMilitarySlider.setSliderMajorTick(10);
  topPanel.add(fakeMilitarySlider);
  topPanel.add(Box.createRigidArea(new Dimension(15, 25)));
  fakeMilitaryText = new InfoTextArea();
  fakeMilitaryText.setEditable(false);
  fakeMilitaryText.setFont(GuiStatics.getFontCubellanSmaller());
  fakeMilitaryText.setCharacterWidth(8);
  fakeMilitaryText.setLineWrap(true);
  JScrollPane scroll = new JScrollPane(fakeMilitaryText);
  scroll.setBackground(GuiStatics.COLOR_DEEP_SPACE_PURPLE_DARK);
  topPanel.add(scroll);
  int humanIndex = playerList.getIndex(info);
  humanNewsMilitarySize = militaryNews.getLatest(humanIndex);

  InfoPanel centerPanel = new InfoPanel();
  centerPanel.setTitle("Espionage");
  centerPanel.setLayout(new GridLayout(2, 4));
  int maxPlayer = playerList.getCurrentMaxRealms();
  for (int i = 0; i < maxPlayer; i++) {
    PlayerInfo realmInfo = playerList.getPlayerInfoByIndex(i);
    EspionageList espionageList = player.getEspionage().getByIndex(i);
    if (espionageList != null) {
      int bonus = player.getEspionage().getByIndex(i).getTotalBonus();
      String desc = EspionageList.getTotalBonusAsDescriptions(bonus);
      int militaryValue = 0;
      if (bonus > 0) {
        militaryValue = NewsCorpData.calculateMilitaryValue(realmInfo);
        militaryValue = espionageList.estimateMilitaryPower(militaryValue);
      }
      int realmIndex = playerList.getIndex(realmInfo);
      int newsValue = militaryNews.getLatest(realmIndex);
      desc = "Military value: " + militaryValue + ".\n"
           + "News value: " + newsValue + ".\n" + desc;
      int spyTrade = player.getDiplomacy().getSpyTradeLasting(i);
      if (spyTrade > 0) {
        desc = desc + "\nSpy trading: " + spyTrade + " turns.";
      }
      String text;
      Color relationColor = null;
      if (i != humanIndex) {
        text = realmInfo.getDiplomacy().generateRelationText(
            humanIndex);
        relationColor = realmInfo.getDiplomacy().getLikingAsColor(
            humanIndex);
      } else {
        text = "Own Realm";
        relationColor = GuiStatics.COLOR_GREEN_TEXT;
      }
      EspionagePanel panel = new EspionagePanel(realmInfo.getEmpireName(),
          desc, bonus, text, relationColor, listener);
      centerPanel.add(panel);
    }
  }

  // Bottom panel
  InfoPanel bottomPanel = new InfoPanel();
  bottomPanel.setLayout(new BorderLayout());
  bottomPanel.setTitle(null);
  SpaceButton btn = new SpaceButton("Back to star map",
      GameCommands.COMMAND_VIEW_STARMAP);
  btn.addActionListener(listener);
  bottomPanel.add(btn, BorderLayout.CENTER);


  // Add panels to base
  this.add(bottomPanel, BorderLayout.SOUTH);
  this.add(centerPanel, BorderLayout.CENTER);
  this.add(topPanel, BorderLayout.NORTH);
  updatePanel();
}
 
源代码11 项目: jdk8u60   文件: DiagramScene.java
public DiagramScene(Action[] actions, DiagramViewModel model) {
    this.actions = actions;
    selectedWidgets = new ArrayList<FigureWidget>();
    content = new InstanceContent();
    lookup = new AbstractLookup(content);
    this.setCheckClipping(true);
    this.getInputBindings().setZoomActionModifiers(0);

    JComponent comp = this.createView();
    comp.setDoubleBuffered(true);
    comp.setBackground(Color.WHITE);
    comp.setOpaque(true);

    this.setBackground(Color.WHITE);
    this.setOpaque(true);
    scrollPane = new JScrollPane(comp);
    scrollPane.setBackground(Color.WHITE);
    scrollPane.getVerticalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getVerticalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getHorizontalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getHorizontalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getViewport().addChangeListener(scrollChangeListener);
    hoverAction = this.createWidgetHoverAction();

    blockLayer = new LayerWidget(this);
    this.addChild(blockLayer);

    startLayer = new LayerWidget(this);
    this.addChild(startLayer);
    // TODO: String startLabelString = "Loading graph with " + originalDiagram.getFigures().size() + " figures and " + originalDiagram.getConnections().size() + " connections...";
    String startLabelString = "";
    LabelWidget w = new LabelWidget(this, startLabelString);
    scrollChangeListener.register(w, new Point(10, 10));
    w.setAlignment(LabelWidget.Alignment.CENTER);
    startLabel = w;
    startLayer.addChild(w);

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    topLeft = new Widget(this);
    topLeft.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(topLeft);


    bottomRight = new Widget(this);
    bottomRight.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(bottomRight);

    slotLayer = new LayerWidget(this);
    this.addChild(slotLayer);

    connectionLayer = new LayerWidget(this);
    this.addChild(connectionLayer);

    LayerWidget selectionLayer = new LayerWidget(this);
    this.addChild(selectionLayer);

    this.setLayout(LayoutFactory.createAbsoluteLayout());

    this.getActions().addAction(hoverAction);
    zoomAction = new BoundedZoomAction(1.1, false);
    zoomAction.setMaxFactor(ZOOM_MAX_FACTOR);
    zoomAction.setMinFactor(ZOOM_MIN_FACTOR);
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
    panAction = new ExtendedPanAction();
    this.getActions().addAction(panAction);
    this.getActions().addAction(ActionFactory.createPopupMenuAction(popupMenuProvider));

    LayerWidget selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(rectangularSelectDecorator, selectLayer, rectangularSelectProvider));

    blockWidgets = new HashMap<InputBlock, BlockWidget>();

    boolean b = this.getUndoRedoEnabled();
    this.setUndoRedoEnabled(false);
    this.setNewModel(model);
    this.setUndoRedoEnabled(b);
}
 
源代码12 项目: jplag   文件: SubmissionTree.java
public SubmissionTree(OptionPanel gui) {
	this.setTitle(Messages.getString("SubmissionTree.SubmissionTree_Title")); //$NON-NLS-1$
	this.setBackground(JPlagCreator.SYSTEMCOLOR);
	this.gui = gui;

	JPanel contentPane = new JPanel();
	contentPane.setPreferredSize(new Dimension(350, 550));
	contentPane.setLayout(new BorderLayout());
	contentPane.setBackground(JPlagCreator.SYSTEMCOLOR);

	JTabbedPane mainPanel = new JTabbedPane();
	mainPanel.setBackground(JPlagCreator.SYSTEMCOLOR);

	makeInvalidTree();
	invalidTree = new JTree(invalidRoot, true);
	invalidTree.setName("JPlag Preview tree"); //$NON-NLS-1$
	JScrollPane invalidScroll = new JScrollPane(invalidTree);
	invalidScroll.getViewport().setBackground(JPlagCreator.SYSTEMCOLOR);
	invalidScroll.getVerticalScrollBar()
			.setBackground(JPlagCreator.SYSTEMCOLOR);
	invalidScroll.setBackground(Color.WHITE);
	invalidScroll.setPreferredSize(new Dimension(350, 500));

	makeValidTree();
	validTree = new JTree(validRoot, true);
	validTree.setName("JPlag Preview tree"); //$NON-NLS-1$

	// This workaround removes all expand controls from empty nodes		
	expandAll();
	collapseAll();
	
	JScrollPane validScroll = new JScrollPane(validTree);
	validScroll.setBackground(JPlagCreator.SYSTEMCOLOR);
	validScroll.getViewport().setBackground(JPlagCreator.SYSTEMCOLOR);
	validScroll.getVerticalScrollBar().setBackground(
			JPlagCreator.SYSTEMCOLOR);
	validScroll.setBackground(Color.WHITE);
	validScroll.setPreferredSize(new Dimension(350, 500));
	mainPanel.setFont(JPlagCreator.SYSTEM_FONT);
	mainPanel.add(Messages.getString("SubmissionTree.Recognized_Structure"), validScroll); //$NON-NLS-1$
	mainPanel.add(Messages.getString("SubmissionTree.Invalid_Items"), invalidScroll); //$NON-NLS-1$

	mainPanel.setBackground(JPlagCreator.SYSTEMCOLOR);
       JPanel pan = JPlagCreator.createPanelWithoutBorder(350,50,10,0,FlowLayout.CENTER);
	JPanel buttons = JPlagCreator.createPanelWithoutBorder(350, 30, 0, 15,FlowLayout.CENTER);
	
	JButton button = JPlagCreator.createButton(
		Messages.getString("SubmissionTree.Expand_all"), //$NON-NLS-1$
		Messages.getString("SubmissionTree.Expand_all_TIP"), //$NON-NLS-1$
		100, 20);
	button.setActionCommand("expand"); //$NON-NLS-1$
	button.addActionListener(this);
	buttons.add(button);
	
	button = JPlagCreator.createButton(
		Messages.getString("SubmissionTree.Collapse_all"), //$NON-NLS-1$
		Messages.getString("SubmissionTree.Collapse_all_TIP"), //$NON-NLS-1$
		100, 20);
	button.setActionCommand("collapse"); //$NON-NLS-1$
	button.addActionListener(this);
	buttons.add(button);

	button = JPlagCreator.createButton(
		Messages.getString("SubmissionTree.Close"), //$NON-NLS-1$
		Messages.getString("SubmissionTree.Close_TIP"), //$NON-NLS-1$
		100, 20);
	button.setActionCommand("close"); //$NON-NLS-1$
	button.addActionListener(this);
	buttons.add(button);
	
	pan.add(buttons);
	contentPane.add(mainPanel, BorderLayout.CENTER);
	contentPane.add(pan, BorderLayout.SOUTH);
	setContentPane(contentPane);
	pack();
	setVisible(true);
	addWindowListener(this);
}
 
源代码13 项目: openjdk-jdk8u-backup   文件: MetalworksInBox.java
public MetalworksInBox() {
    super("In Box", true, true, true, true);

    DefaultMutableTreeNode unread;
    DefaultMutableTreeNode personal;
    DefaultMutableTreeNode business;
    DefaultMutableTreeNode spam;

    DefaultMutableTreeNode top = new DefaultMutableTreeNode("Mail Boxes");

    top.add(unread = new DefaultMutableTreeNode("Unread Mail"));
    top.add(personal = new DefaultMutableTreeNode("Personal"));
    top.add(business = new DefaultMutableTreeNode("Business"));
    top.add(spam = new DefaultMutableTreeNode("Spam"));

    unread.add(new DefaultMutableTreeNode("Buy Stuff Now"));
    unread.add(new DefaultMutableTreeNode("Read Me Now"));
    unread.add(new DefaultMutableTreeNode("Hot Offer"));
    unread.add(new DefaultMutableTreeNode("Re: Re: Thank You"));
    unread.add(new DefaultMutableTreeNode("Fwd: Good Joke"));

    personal.add(new DefaultMutableTreeNode("Hi"));
    personal.add(new DefaultMutableTreeNode("Good to hear from you"));
    personal.add(new DefaultMutableTreeNode("Re: Thank You"));

    business.add(new DefaultMutableTreeNode("Thanks for your order"));
    business.add(new DefaultMutableTreeNode("Price Quote"));
    business.add(new DefaultMutableTreeNode("Here is the invoice"));
    business.add(new DefaultMutableTreeNode(
            "Project Metal: delivered on time"));
    business.add(new DefaultMutableTreeNode("Your salary raise approved"));

    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Make $$$ Now"));
    spam.add(new DefaultMutableTreeNode("HOT HOT HOT"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Don't Miss This"));
    spam.add(new DefaultMutableTreeNode("Opportunity in Precious Metals"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Last Chance"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Make $$$ Now"));
    spam.add(new DefaultMutableTreeNode("To Hot To Handle"));
    spam.add(new DefaultMutableTreeNode("I'm waiting for your call"));

    JTree tree = new JTree(top);
    JScrollPane treeScroller = new JScrollPane(tree);
    treeScroller.setBackground(tree.getBackground());
    setContentPane(treeScroller);
    setSize(325, 200);
    setLocation(75, 75);

}
 
源代码14 项目: jdk8u-jdk   文件: MetalworksInBox.java
public MetalworksInBox() {
    super("In Box", true, true, true, true);

    DefaultMutableTreeNode unread;
    DefaultMutableTreeNode personal;
    DefaultMutableTreeNode business;
    DefaultMutableTreeNode spam;

    DefaultMutableTreeNode top = new DefaultMutableTreeNode("Mail Boxes");

    top.add(unread = new DefaultMutableTreeNode("Unread Mail"));
    top.add(personal = new DefaultMutableTreeNode("Personal"));
    top.add(business = new DefaultMutableTreeNode("Business"));
    top.add(spam = new DefaultMutableTreeNode("Spam"));

    unread.add(new DefaultMutableTreeNode("Buy Stuff Now"));
    unread.add(new DefaultMutableTreeNode("Read Me Now"));
    unread.add(new DefaultMutableTreeNode("Hot Offer"));
    unread.add(new DefaultMutableTreeNode("Re: Re: Thank You"));
    unread.add(new DefaultMutableTreeNode("Fwd: Good Joke"));

    personal.add(new DefaultMutableTreeNode("Hi"));
    personal.add(new DefaultMutableTreeNode("Good to hear from you"));
    personal.add(new DefaultMutableTreeNode("Re: Thank You"));

    business.add(new DefaultMutableTreeNode("Thanks for your order"));
    business.add(new DefaultMutableTreeNode("Price Quote"));
    business.add(new DefaultMutableTreeNode("Here is the invoice"));
    business.add(new DefaultMutableTreeNode(
            "Project Metal: delivered on time"));
    business.add(new DefaultMutableTreeNode("Your salary raise approved"));

    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Make $$$ Now"));
    spam.add(new DefaultMutableTreeNode("HOT HOT HOT"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Don't Miss This"));
    spam.add(new DefaultMutableTreeNode("Opportunity in Precious Metals"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Last Chance"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Make $$$ Now"));
    spam.add(new DefaultMutableTreeNode("To Hot To Handle"));
    spam.add(new DefaultMutableTreeNode("I'm waiting for your call"));

    JTree tree = new JTree(top);
    JScrollPane treeScroller = new JScrollPane(tree);
    treeScroller.setBackground(tree.getBackground());
    setContentPane(treeScroller);
    setSize(325, 200);
    setLocation(75, 75);

}
 
源代码15 项目: openjdk-8   文件: DiagramScene.java
public DiagramScene(Action[] actions, DiagramViewModel model) {
    this.actions = actions;
    selectedWidgets = new ArrayList<FigureWidget>();
    content = new InstanceContent();
    lookup = new AbstractLookup(content);
    this.setCheckClipping(true);
    this.getInputBindings().setZoomActionModifiers(0);

    JComponent comp = this.createView();
    comp.setDoubleBuffered(true);
    comp.setBackground(Color.WHITE);
    comp.setOpaque(true);

    this.setBackground(Color.WHITE);
    this.setOpaque(true);
    scrollPane = new JScrollPane(comp);
    scrollPane.setBackground(Color.WHITE);
    scrollPane.getVerticalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getVerticalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getHorizontalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getHorizontalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getViewport().addChangeListener(scrollChangeListener);
    hoverAction = this.createWidgetHoverAction();

    blockLayer = new LayerWidget(this);
    this.addChild(blockLayer);

    startLayer = new LayerWidget(this);
    this.addChild(startLayer);
    // TODO: String startLabelString = "Loading graph with " + originalDiagram.getFigures().size() + " figures and " + originalDiagram.getConnections().size() + " connections...";
    String startLabelString = "";
    LabelWidget w = new LabelWidget(this, startLabelString);
    scrollChangeListener.register(w, new Point(10, 10));
    w.setAlignment(LabelWidget.Alignment.CENTER);
    startLabel = w;
    startLayer.addChild(w);

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    topLeft = new Widget(this);
    topLeft.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(topLeft);


    bottomRight = new Widget(this);
    bottomRight.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(bottomRight);

    slotLayer = new LayerWidget(this);
    this.addChild(slotLayer);

    connectionLayer = new LayerWidget(this);
    this.addChild(connectionLayer);

    LayerWidget selectionLayer = new LayerWidget(this);
    this.addChild(selectionLayer);

    this.setLayout(LayoutFactory.createAbsoluteLayout());

    this.getActions().addAction(hoverAction);
    zoomAction = new BoundedZoomAction(1.1, false);
    zoomAction.setMaxFactor(ZOOM_MAX_FACTOR);
    zoomAction.setMinFactor(ZOOM_MIN_FACTOR);
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
    panAction = new ExtendedPanAction();
    this.getActions().addAction(panAction);
    this.getActions().addAction(ActionFactory.createPopupMenuAction(popupMenuProvider));

    LayerWidget selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(rectangularSelectDecorator, selectLayer, rectangularSelectProvider));

    blockWidgets = new HashMap<InputBlock, BlockWidget>();

    boolean b = this.getUndoRedoEnabled();
    this.setUndoRedoEnabled(false);
    this.setNewModel(model);
    this.setUndoRedoEnabled(b);
}
 
源代码16 项目: Open-Realms-of-Stars   文件: LoadGameView.java
/**
 * Constructor for Load Game View
 * @param listener ActionListener
 */
public LoadGameView(final ActionListener listener) {
  Planet planet = new Planet(new Coordinate(1, 1), "Load Game Planet", 1,
      false);
  planet.setPlanetType(PlanetTypes.getRandomPlanetType(true, true, true));
  if (planet.getPlanetType().isGasGiant()) {
    planet.setGasGiant(true);
  }
  // Background image
  BigImagePanel imgBase = new BigImagePanel(planet, true, "Load game");
  imgBase.setLayout(new BorderLayout());
  this.setLayout(new BorderLayout());

  InvisiblePanel invisible = new InvisiblePanel(imgBase);
  invisible.setLayout(new BoxLayout(invisible, BoxLayout.Y_AXIS));
  invisible.add(Box.createRigidArea(new Dimension(500, 250)));

  InvisiblePanel xinvis = new InvisiblePanel(invisible);
  xinvis.setLayout(new BoxLayout(xinvis, BoxLayout.X_AXIS));
  xinvis.add(Box.createRigidArea(new Dimension(200, 5)));
  InfoPanel info = new InfoPanel();
  info.setLayout(new BoxLayout(info, BoxLayout.Y_AXIS));
  info.setTitle("Saved games");
  info.add(Box.createRigidArea(new Dimension(5, 5)));

  File folder = new File("saves");
  File[] files = folder.listFiles(new GenericFileFilter(".save"));
  if (files == null) {
    files = new File[0];
  }

  ArrayList<SavedGame> listOfGames = new ArrayList<>();
  for (int i = 0; i < files.length; i++) {
    try {
      listOfGames.add(new SavedGame(GameRepository.DEFAULT_SAVE_FOLDER,
                               files[i].getName()));
    } catch (IOException e) {
      ErrorLogger.log("Failed reading save game " + files[i].getName());
    }
  }
  Collections.sort(listOfGames);
  SavedGame[] games = listOfGames.toArray(new SavedGame[listOfGames.size()]);

  saveGamesList = new JList<>(games);

  saveGamesList.setCellRenderer(new SaveGameListRenderer());
  JScrollPane scroll = new JScrollPane(saveGamesList);
  scroll.setBackground(GuiStatics.COLOR_DEEP_SPACE_PURPLE_DARK);
  saveGamesList.setBackground(Color.BLACK);
  saveGamesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  info.add(scroll);
  info.add(Box.createRigidArea(new Dimension(10, 10)));
  xinvis.add(info);
  xinvis.add(Box.createRigidArea(new Dimension(200, 5)));
  invisible.add(xinvis);

  imgBase.add(invisible, BorderLayout.CENTER);

  invisible = new InvisiblePanel(imgBase);
  invisible.setLayout(new BorderLayout());
  SpaceButton btn = new SpaceButton("Cancel", GameCommands.COMMAND_CANCEL);
  btn.addActionListener(listener);
  btn.setAlignmentX(Component.CENTER_ALIGNMENT);
  invisible.add(btn, BorderLayout.WEST);
  btn = new SpaceButton("Load", GameCommands.COMMAND_NEXT);
  btn.addActionListener(listener);
  btn.setAlignmentX(Component.CENTER_ALIGNMENT);
  invisible.add(btn, BorderLayout.EAST);
  imgBase.add(invisible, BorderLayout.SOUTH);
  this.add(imgBase, BorderLayout.CENTER);

}
 
源代码17 项目: openjdk-jdk8u   文件: MetalworksInBox.java
public MetalworksInBox() {
    super("In Box", true, true, true, true);

    DefaultMutableTreeNode unread;
    DefaultMutableTreeNode personal;
    DefaultMutableTreeNode business;
    DefaultMutableTreeNode spam;

    DefaultMutableTreeNode top = new DefaultMutableTreeNode("Mail Boxes");

    top.add(unread = new DefaultMutableTreeNode("Unread Mail"));
    top.add(personal = new DefaultMutableTreeNode("Personal"));
    top.add(business = new DefaultMutableTreeNode("Business"));
    top.add(spam = new DefaultMutableTreeNode("Spam"));

    unread.add(new DefaultMutableTreeNode("Buy Stuff Now"));
    unread.add(new DefaultMutableTreeNode("Read Me Now"));
    unread.add(new DefaultMutableTreeNode("Hot Offer"));
    unread.add(new DefaultMutableTreeNode("Re: Re: Thank You"));
    unread.add(new DefaultMutableTreeNode("Fwd: Good Joke"));

    personal.add(new DefaultMutableTreeNode("Hi"));
    personal.add(new DefaultMutableTreeNode("Good to hear from you"));
    personal.add(new DefaultMutableTreeNode("Re: Thank You"));

    business.add(new DefaultMutableTreeNode("Thanks for your order"));
    business.add(new DefaultMutableTreeNode("Price Quote"));
    business.add(new DefaultMutableTreeNode("Here is the invoice"));
    business.add(new DefaultMutableTreeNode(
            "Project Metal: delivered on time"));
    business.add(new DefaultMutableTreeNode("Your salary raise approved"));

    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Make $$$ Now"));
    spam.add(new DefaultMutableTreeNode("HOT HOT HOT"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Don't Miss This"));
    spam.add(new DefaultMutableTreeNode("Opportunity in Precious Metals"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Last Chance"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Make $$$ Now"));
    spam.add(new DefaultMutableTreeNode("To Hot To Handle"));
    spam.add(new DefaultMutableTreeNode("I'm waiting for your call"));

    JTree tree = new JTree(top);
    JScrollPane treeScroller = new JScrollPane(tree);
    treeScroller.setBackground(tree.getBackground());
    setContentPane(treeScroller);
    setSize(325, 200);
    setLocation(75, 75);

}
 
源代码18 项目: netbeans   文件: TimedTakeSnapshotProfilingPoint.java
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);
}
 
源代码19 项目: netbeans   文件: TakeSnapshotProfilingPoint.java
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);
}
 
源代码20 项目: openjdk-8-source   文件: MetalworksInBox.java
public MetalworksInBox() {
    super("In Box", true, true, true, true);

    DefaultMutableTreeNode unread;
    DefaultMutableTreeNode personal;
    DefaultMutableTreeNode business;
    DefaultMutableTreeNode spam;

    DefaultMutableTreeNode top = new DefaultMutableTreeNode("Mail Boxes");

    top.add(unread = new DefaultMutableTreeNode("Unread Mail"));
    top.add(personal = new DefaultMutableTreeNode("Personal"));
    top.add(business = new DefaultMutableTreeNode("Business"));
    top.add(spam = new DefaultMutableTreeNode("Spam"));

    unread.add(new DefaultMutableTreeNode("Buy Stuff Now"));
    unread.add(new DefaultMutableTreeNode("Read Me Now"));
    unread.add(new DefaultMutableTreeNode("Hot Offer"));
    unread.add(new DefaultMutableTreeNode("Re: Re: Thank You"));
    unread.add(new DefaultMutableTreeNode("Fwd: Good Joke"));

    personal.add(new DefaultMutableTreeNode("Hi"));
    personal.add(new DefaultMutableTreeNode("Good to hear from you"));
    personal.add(new DefaultMutableTreeNode("Re: Thank You"));

    business.add(new DefaultMutableTreeNode("Thanks for your order"));
    business.add(new DefaultMutableTreeNode("Price Quote"));
    business.add(new DefaultMutableTreeNode("Here is the invoice"));
    business.add(new DefaultMutableTreeNode(
            "Project Metal: delivered on time"));
    business.add(new DefaultMutableTreeNode("Your salary raise approved"));

    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Make $$$ Now"));
    spam.add(new DefaultMutableTreeNode("HOT HOT HOT"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Don't Miss This"));
    spam.add(new DefaultMutableTreeNode("Opportunity in Precious Metals"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Last Chance"));
    spam.add(new DefaultMutableTreeNode("Buy Now"));
    spam.add(new DefaultMutableTreeNode("Make $$$ Now"));
    spam.add(new DefaultMutableTreeNode("To Hot To Handle"));
    spam.add(new DefaultMutableTreeNode("I'm waiting for your call"));

    JTree tree = new JTree(top);
    JScrollPane treeScroller = new JScrollPane(tree);
    treeScroller.setBackground(tree.getBackground());
    setContentPane(treeScroller);
    setSize(325, 200);
    setLocation(75, 75);

}