Java Code Examples for javax.swing.JPanel.setOpaque()

The following are Jave code examples for showing how to use setOpaque() of the javax.swing.JPanel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: JuggleMasterPro   File: PreferencesJDialog.java   View Source Code Vote up 6 votes
/**
 * @return
 */
final private JPanel getSoundsJPanel() {

	final JPanel objLsoundsJCheckBoxesJPanel = new JPanel(new GridBagLayout());
	objLsoundsJCheckBoxesJPanel.setOpaque(true);
	final ExtendedGridBagConstraints objLjCheckBoxesExtendedGridBagConstraints = new ExtendedGridBagConstraints(GridBagConstraints.RELATIVE, 0);
	objLsoundsJCheckBoxesJPanel.add(this.objGbooleanLocalJCheckBoxA[PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_SOUNDS]);
	final JPanel objLsoundsJCheckBoxJPanel = new JPanel();
	objLsoundsJCheckBoxJPanel.setLayout(new BoxLayout(objLsoundsJCheckBoxJPanel, BoxLayout.LINE_AXIS));
	objLsoundsJCheckBoxJPanel.add(this.objGbooleanLocalJLabelA[PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_SOUNDS]);
	objLsoundsJCheckBoxJPanel.add(new JLabel(" :"));
	objLsoundsJCheckBoxesJPanel.add(objLsoundsJCheckBoxJPanel, objLjCheckBoxesExtendedGridBagConstraints);

	byte bytLposY = 1;
	for (final byte bytLbooleanLocalIndex : new byte[] { PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_CATCH_SOUNDS,
		PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_THROW_SOUNDS, PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_METRONOME }) {
		final JPanel objLjPanel = new JPanel();
		objLjPanel.setLayout(new BoxLayout(objLjPanel, BoxLayout.LINE_AXIS));
		objLjPanel.add(this.objGbooleanLocalJCheckBoxA[bytLbooleanLocalIndex]);
		objLjPanel.add(this.objGbooleanLocalJLabelA[bytLbooleanLocalIndex]);
		this.setSoundsJLabelsEnabled();
		objLjCheckBoxesExtendedGridBagConstraints.setGridLocation(1, bytLposY++);
		objLsoundsJCheckBoxesJPanel.add(objLjPanel, objLjCheckBoxesExtendedGridBagConstraints);
	}
	return objLsoundsJCheckBoxesJPanel;
}
 
Example 2
Project: POPBL_V   File: RecordAdapter.java   View Source Code Vote up 6 votes
@Override
public Component getListCellRendererComponent(JList<? extends Record> recordList, Record record, int index,
		boolean selected, boolean focus) {

	JPanel panel = new JPanel(new BorderLayout(10, 10));

	JLabel lTitulo = new JLabel(record.getName());
	lTitulo.setFont(new Font("Arial", Font.CENTER_BASELINE, 16));
	lTitulo.setForeground(selected ? Color.WHITE : Color.BLACK);

	panel.add(lTitulo, BorderLayout.CENTER);

	panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
	panel.setBackground(selected ? new Color(255, 107, 107) : Color.WHITE);
	panel.setOpaque(true);

	return panel;
}
 
Example 3
Project: incubator-netbeans   File: ArticlesAndNews.java   View Source Code Vote up 6 votes
protected JComponent buildBottomContent() {
    WebLink news = new WebLink("AllNews", true); // NOI18N
    BundleSupport.setAccessibilityProperties( news, "AllNews" ); //NOI18N
    
    WebLink articles = new WebLink( "AllArticles", true); // NOI18N
    BundleSupport.setAccessibilityProperties( articles, "AllArticles" ); //NOI18N

    JPanel panel = new JPanel( new GridBagLayout() );
    panel.setOpaque(false);

    panel.add( news, new GridBagConstraints(0,1,1,1,0.0,0.0,
            GridBagConstraints.SOUTHWEST,GridBagConstraints.HORIZONTAL,
            new Insets(5,0,0,15),0,0) );
    panel.add( new JLabel(), new GridBagConstraints(1,1,1,1,1.0,0.0,
            GridBagConstraints.CENTER,GridBagConstraints.HORIZONTAL,
            new Insets(5,5,0,0),0,0) );
    panel.add( articles, new GridBagConstraints(2,1,1,1,0.0,0.0,
            GridBagConstraints.SOUTHEAST,GridBagConstraints.HORIZONTAL,
            new Insets(5,5,0,0),0,0) );

    return panel;
}
 
Example 4
Project: freecol   File: InfoPanel.java   View Source Code Vote up 6 votes
/**
 * Updates this {@code InfoPanel}.
 *
 * @param mapTransform The current MapTransform.
 */
public void update(MapTransform mapTransform) {
    final JPanel p = (mapTransform == null) ? null
        : mapTransform.getDescriptionPanel();
    if (p != null) {
        p.setOpaque(false);
        final Dimension d = p.getPreferredSize();
        p.setBounds(0, (this.mapEditorPanel.getHeight() - d.height)/2,
            this.mapEditorPanel.getWidth(), d.height);
        this.mapEditorPanel.removeAll();
        this.mapEditorPanel.add(p, BorderLayout.CENTER);
        this.mapEditorPanel.validate();
        this.mapEditorPanel.revalidate();
    }
    update();
}
 
Example 5
Project: incubator-netbeans   File: SettingsPanel.java   View Source Code Vote up 5 votes
private static int defaultHeight() {
    if (DEFAULT_HEIGHT == -1) {
        JPanel ref = new JPanel(null);
        ref.setLayout(new BoxLayout(ref, BoxLayout.LINE_AXIS));
        ref.setOpaque(false);
        
        ref.add(new JLabel("XXX")); // NOI18N
        
        ref.add(new JButton("XXX")); // NOI18N
        ref.add(new PopupButton("XXX")); // NOI18N
        
        ref.add(new JCheckBox("XXX")); // NOI18N
        ref.add(new JRadioButton("XXX")); // NOI18N
        
        ref.add(new JTextField("XXX")); // NOI18N
        
        ref.add(new JExtendedSpinner(new SpinnerNumberModel(1, 1, 655535, 1)));
        
        Component separator = Box.createHorizontalStrut(1);
        Dimension d = separator.getMaximumSize(); d.height = 20;
        separator.setMaximumSize(d);
        ref.add(separator);
        
        DEFAULT_HEIGHT = ref.getPreferredSize().height;
    }
    return DEFAULT_HEIGHT;
}
 
Example 6
Project: jmt   File: AboutDialogPanel.java   View Source Code Vote up 5 votes
/**
 * Initialize the panel
 */
private void initialize() {
	// Initialize dialog layout
	
	JPanel panel = new JPanel(new BorderLayout(BORDERSIZE / 2, BORDERSIZE / 2));
	panel.setBorder(BorderFactory.createEmptyBorder(BORDERSIZE, BORDERSIZE, BORDERSIZE, BORDERSIZE));
	// Adds website image
	JPanel tmpPanel = new JPanel(new BorderLayout(BORDERSIZE, BORDERSIZE));
	// Adds polimi description
	HtmlPanel titleLabel = new HtmlPanel();
	titleLabel.setText(GraphStartScreen.HTML_CONTENT_TITLE_HREF);
	titleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
	titleLabel.setAlignmentY(Component.CENTER_ALIGNMENT);
	titleLabel.setOpaque(false);
	tmpPanel.add(titleLabel, BorderLayout.CENTER);

	// Adds application title
	title = new JLabel();
	title.setHorizontalTextPosition(SwingConstants.RIGHT);
	title.setHorizontalAlignment(SwingConstants.CENTER);
	title.setIconTextGap(BORDERSIZE);
	tmpPanel.add(title, BorderLayout.SOUTH);

	panel.add(tmpPanel, BorderLayout.NORTH);

	// Adds text area
	mainArea = new JPanel();
	mainArea.setOpaque(false);
	BoxLayout mainLayout = new BoxLayout(mainArea, BoxLayout.Y_AXIS);
	mainArea.setLayout(mainLayout);
	
	panel.add(mainArea, BorderLayout.CENTER);

	JLabel legal = new JLabel(LEGAL);
	panel.add(legal, BorderLayout.SOUTH);
	panel.setPreferredSize(new Dimension(600,480));
	JScrollPane scroll = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	this.add(scroll, BorderLayout.CENTER);
}
 
Example 7
Project: incubator-netbeans   File: WhatsNewTab.java   View Source Code Vote up 5 votes
@Override
protected JComponent buildContent() {
    JPanel main = new JPanel( new GridLayout(1,0) );
    main.setOpaque(false);
    main.setBorder(BorderFactory.createEmptyBorder());

    main.add( new ContentSection( BundleSupport.getLabel( "SectionNewsAndTutorials" ), //NOI18N
            new ArticlesAndNews(), true ));
    
    main.add( new ContentSection( BundleSupport.getLabel( "SectionBlogs" ), //NOI18N
            new Blogs(), true ) );

    return main;
}
 
Example 8
Project: iTrace-Archive   File: CrosshairWindow.java   View Source Code Vote up 5 votes
public CrosshairWindow() {
    super.setLocation(-10, -10);
    setSize(16,16);
    setBackground(new Color(0,0,255,0));
    JPanel crosshairPanel = new CrosshairPanel();
    crosshairPanel.setOpaque(false);
    add(crosshairPanel);
    centre = new Point(8,8);
    setAlwaysOnTop(true);
}
 
Example 9
Project: freecol   File: FreeColMenuTest.java   View Source Code Vote up 5 votes
public Container createContentPane() {
    //Create the content-pane-to-be.
    JPanel contentPane = new JPanel(new BorderLayout());
    contentPane.setOpaque(true);

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

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

    return contentPane;
}
 
Example 10
Project: incubator-netbeans   File: RSSFeed.java   View Source Code Vote up 5 votes
private JComponent buildProxyPanel() {
    Component header = getContentHeader();
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque( false );

    int row = 0;
    if( null != header ) {
        panel.add( header,  new GridBagConstraints(0,row++,1,1,1.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0 ) );
    }

    panel.add( new JLabel(BundleSupport.getLabel("ErrCannotConnect")),  // NOI18N
            new GridBagConstraints(0,row++,1,1,0.0,0.0,
            GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    if( showProxyButton ) {
        JButton button = new JButton();
        Mnemonics.setLocalizedText( button, BundleSupport.getLabel( "ProxyConfig" ) );  // NOI18N
        button.setOpaque( false );
        button.addActionListener( new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                HttpProxySettings.getDefault().showConfigurationDialog();
            }
        });
        panel.add( button, new GridBagConstraints(0,row++,1,1,0.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    }
    return panel;
}
 
Example 11
Project: POPBL_V   File: RecordPanel.java   View Source Code Vote up 5 votes
private Component recordPanel() {
	JPanel panel = new JPanel(new BorderLayout(0, 5));
	panel.setOpaque(false);

	panel.add(titlePanel(), BorderLayout.NORTH);
	panel.add(listPanel(), BorderLayout.CENTER);

	return panel;
}
 
Example 12
Project: POPBL_V   File: StatusPanel.java   View Source Code Vote up 5 votes
private Component topPanel() {
	JPanel panel = new JPanel(new FlowLayout());
	panel.setBorder(BorderFactory.createEmptyBorder(28, 0, 0, 0));
	panel.setOpaque(false);

	statusImage = new JLabel(new ImageIcon(References.STANDBY_IMAGE));

	panel.add(statusImage);

	return panel;
}
 
Example 13
Project: rapidminer   File: ANOVAMatrixViewer.java   View Source Code Vote up 5 votes
public ANOVAMatrixViewer(ANOVAMatrix matrix) {
	super(new BorderLayout());

	JPanel panel = new JPanel(new GridBagLayout());
	panel.setOpaque(true);
	panel.setBackground(Colors.WHITE);

	GridBagConstraints gbc = new GridBagConstraints();
	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.weightx = 1.0;
	gbc.weighty = 1.0;
	gbc.fill = GridBagConstraints.BOTH;
	gbc.insets = new Insets(42, 10, 20, 10);

	// table
	ANOVAMatrixViewerTable table = new ANOVAMatrixViewerTable(matrix);
	table.getTableHeader().putClientProperty(RapidLookTools.PROPERTY_TABLE_HEADER_BACKGROUND, Colors.WHITE);
	((TableHeaderUI) table.getTableHeader().getUI()).installDefaults();
	table.setRowHighlighting(true);
	table.setRowHeight(PropertyPanel.VALUE_CELL_EDITOR_HEIGHT);

	JScrollPane scrollPane = new ExtendedJScrollPane(table);
	scrollPane.setBorder(null);
	scrollPane.setBackground(Colors.WHITE);
	scrollPane.getViewport().setBackground(Colors.WHITE);
	panel.add(scrollPane, gbc);

	// info string
	JLabel infoText = new JLabel();
	infoText.setText("A colored background indicates that the probability for non-difference between the groups is less than "
			+ Tools.formatNumber(matrix.getSignificanceLevel()));
	gbc.gridy += 1;
	gbc.insets = new Insets(5, 10, 5, 10);
	gbc.weighty = 0.0;
	gbc.fill = GridBagConstraints.HORIZONTAL;
	panel.add(infoText, gbc);

	add(panel, BorderLayout.CENTER);
}
 
Example 14
Project: jmt   File: Sectors3DPanel.java   View Source Code Vote up 5 votes
/**
 * Builds a new Sectors3D Panel to show results of 3-class models
 * @param s3d results vector
 * @param classNames array with class names
 */
public Sectors3DPanel(Vector<Object> s3d, String[] classNames) {
	super(new BorderLayout());
	this.s3d = s3d;
	this.classNames = classNames;
	this.setBackground(BGCOLOR);
	this.setBorder(BorderFactory.createEtchedBorder());

	// Label to show coordinates
	coordLabel = new JLabel();
	coordLabel.setBorder(BorderFactory.createEtchedBorder());
	coordLabel.setVisible(false);
	coordLabel.setOpaque(true);
	// Puts label on south-east corner
	JPanel tmp = new JPanel(new BorderLayout());
	tmp.add(coordLabel, BorderLayout.EAST);
	tmp.setOpaque(false);
	this.add(tmp, BorderLayout.SOUTH);

	// Adds a mouseListener to show graph coordinates
	this.addMouseMotionListener(new MouseMotionAdapter() {
		@Override
		public void mouseMoved(MouseEvent e) {
			if (isShown) {
				String coord = getCoordinates(e.getX(), e.getY());
				if (coord != null) {
					coordLabel.setText(coord);
					coordLabel.setVisible(true);
					Sectors3DPanel.this.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
				} else {
					coordLabel.setText("");
					coordLabel.setVisible(false);
					Sectors3DPanel.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
				}
			}
		}
	});
}
 
Example 15
Project: JuggleMasterPro   File: PreferencesJDialog.java   View Source Code Vote up 5 votes
final private JPanel getColorsJPanel() {
	final JPanel objLpreferencesColorsJPanel = new JPanel(new GridBagLayout());
	objLpreferencesColorsJPanel.setOpaque(true);
	final ExtendedGridBagConstraints objLcolorsJLabelsExtendedGridBagConstraints =
																					new ExtendedGridBagConstraints(	0,
																													GridBagConstraints.RELATIVE,
																													1,
																													1,
																													GridBagConstraints.EAST,
																													10,
																													10,
																													10,
																													5);
	final ExtendedGridBagConstraints objLcolorsJButtonsExtendedGridBagConstraints =
																					new ExtendedGridBagConstraints(	1,
																													GridBagConstraints.RELATIVE,
																													1,
																													1,
																													GridBagConstraints.WEST,
																													Constants.objS_GRAPHICS_FONT_METRICS.getAscent(),
																													Constants.objS_GRAPHICS_FONT_METRICS.getAscent(),
																													10,
																													10,
																													0,
																													10);
	for (byte bytLpreferenceIndex = 0; bytLpreferenceIndex < PreferencesJDialog.bytS_STRING_LOCAL_PREFERENCES_NUMBER; ++bytLpreferenceIndex) {
		if (bytLpreferenceIndex == PreferencesJDialog.bytS_STRING_LOCAL_PREFERENCES_NUMBER / 2) {
			objLcolorsJLabelsExtendedGridBagConstraints.setGridBounds(2, GridBagConstraints.RELATIVE, 1, 1);
			objLcolorsJButtonsExtendedGridBagConstraints.setGridBounds(3, GridBagConstraints.RELATIVE, 1, 1);
		}
		objLpreferencesColorsJPanel.add(this.objGstringLocalJLabelA[bytLpreferenceIndex], objLcolorsJLabelsExtendedGridBagConstraints);
		objLpreferencesColorsJPanel.add(this.objGstringLocalColorJButtonA[bytLpreferenceIndex], objLcolorsJButtonsExtendedGridBagConstraints);
	}

	return objLpreferencesColorsJPanel;
}
 
Example 16
Project: FreeCol   File: LoadingSavegameDialog.java   View Source Code Vote up 4 votes
/**
 * Creates a dialog to set the options for loading a saved game.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 */
public LoadingSavegameDialog(FreeColClient freeColClient, JFrame frame) {
    super(freeColClient, frame);

    JPanel panel = new JPanel();
    panel.setBorder(Utility.blankBorder(10, 10, 10, 10));
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    panel.setOpaque(false);

    JLabel header = Utility.localizedHeaderLabel(
        Messages.nameKey("loadingSavegameDialog"), JLabel.CENTER,
        FontLibrary.FontSize.MEDIUM);
    header.setBorder(Utility.blankBorder(20, 0, 0, 0));

    JPanel p1 = new JPanel(new FlowLayout(FlowLayout.LEADING));
    p1.add(Utility.localizedLabel("loadingSavegameDialog.serverName"));

    serverNameField = new JTextField();

    JPanel p2 = new JPanel(new FlowLayout(FlowLayout.LEADING));
    p2.add(Utility.localizedLabel("loadingSavegameDialog.port"));

    portField = new JSpinner(new SpinnerNumberModel(FreeCol.getServerPort(),
                                                    1, 65536, 1));
    ButtonGroup bg = new ButtonGroup();
    String str = Messages.message("loadingSavegameDialog.singlePlayer");
    singlePlayer = new JRadioButton(str);
    bg.add(singlePlayer);
    str = Messages.message("loadingSavegameDialog.privateMultiplayer");
    privateMultiplayer = new JRadioButton(str);
    bg.add(privateMultiplayer);
    str = Messages.message("loadingSavegameDialog.publicMultiplayer");
    publicMultiplayer = new JRadioButton(str);
    bg.add(publicMultiplayer);

    panel.add(header);
    panel.add(p1);
    panel.add(serverNameField);
    panel.add(p2);
    panel.add(portField);
    panel.add(singlePlayer);
    panel.add(privateMultiplayer);
    panel.add(publicMultiplayer);
    panel.setSize(panel.getPreferredSize());

    initializeConfirmDialog(frame, true, panel, null, "ok", "cancel");
}
 
Example 17
Project: JuggleMasterPro   File: ColorChooserDropDownJButton.java   View Source Code Vote up 4 votes
final private void setBallsColorsPopUp() {
	final JPanel objLjPanel = new JPanel(new GridBagLayout());
	objLjPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
	objLjPanel.setOpaque(true);
	final ExtendedGridBagConstraints objLextendedGridBagConstraints =
																		new ExtendedGridBagConstraints(	GridBagConstraints.RELATIVE,
																										0,
																										1,
																										1,
																										GridBagConstraints.CENTER,
																										0,
																										0);
	for (byte bytLshadeIndex = 0; bytLshadeIndex < BallsColors.bytS_BALLS_COLORS_SHADES_NUMBER; ++bytLshadeIndex) {
		for (byte bytLcolorLetterIndex = Constants.bytS_UNCLASS_NO_VALUE; bytLcolorLetterIndex <= BallsColors.bytS_BALLS_COLORS_LETTERS_NUMBER; ++bytLcolorLetterIndex) {
			objLextendedGridBagConstraints.setGridLocation(GridBagConstraints.RELATIVE, BallsColors.bytS_BALLS_COLORS_SHADES_NUMBER
																						- bytLshadeIndex);
			switch (bytLshadeIndex) {
				case 0:
				case BallsColors.bytS_BALLS_COLORS_SHADE_MAXIMUM_VALUE:
					final ExtendedJLabel objLjLabel =
														new ExtendedJLabel(	this.objGcontrolJFrame,
																			bytLcolorLetterIndex != Constants.bytS_UNCLASS_NO_VALUE
																				&& bytLcolorLetterIndex != BallsColors.bytS_BALLS_COLORS_LETTERS_NUMBER
																																						? Character.toString(BallsColors.chrS_BALLS_COLORS_LETTER_A[bytLcolorLetterIndex])
																																						: null);
					if (0 <= bytLcolorLetterIndex && bytLcolorLetterIndex < BallsColors.bytS_BALLS_COLORS_LETTERS_NUMBER) {
						objLjLabel.setToolTipText(Preferences.getGlobalBooleanPreference(Constants.bytS_BOOLEAN_GLOBAL_BUTTONS_TOOLTIPS)
																																		? BallsColors.strS_BALLS_COLORS_LETTER_A[bytLcolorLetterIndex]
																																		: null);
					}
					objLjLabel.setFont(objLjLabel.getFont().deriveFont(8.0F));
					objLjPanel.add(objLjLabel, objLextendedGridBagConstraints);
					break;
				default:
					final boolean bolLrowHeader =
													bytLcolorLetterIndex == Constants.bytS_UNCLASS_NO_VALUE
														|| bytLcolorLetterIndex == BallsColors.bytS_BALLS_COLORS_LETTERS_NUMBER;
					final JComponent objLjComponent =
														bolLrowHeader
																		? new ExtendedJLabel(	this.objGcontrolJFrame,
																								Byte.toString(bytLshadeIndex))
																		: new BallColorJButton(	this.objGcontrolJFrame,
																								BallsColors.getLogicalColorValue(	bytLcolorLetterIndex,
																																	bytLshadeIndex,
																																	true));

					objLjComponent.setFont(this.objGcontrolJFrame.getFont().deriveFont(8.0F));
					objLjComponent.setOpaque(true);
					if (bolLrowHeader) {
						objLextendedGridBagConstraints.setMargins(	0,
																	0,
																	bytLcolorLetterIndex == Constants.bytS_UNCLASS_NO_VALUE ? 0 : 3,
																	bytLcolorLetterIndex == Constants.bytS_UNCLASS_NO_VALUE ? 3 : 0);
					}
					objLjPanel.add(objLjComponent, objLextendedGridBagConstraints);
					if (bolLrowHeader) {
						objLextendedGridBagConstraints.setMargins(0, 0, 0, 0);
					}
			}
		}
	}
	this.objGjWindow.setBackground(Constants.objS_PEN_COLORS_LIGHT_YELLOW_COLOR);
	this.objGjWindow.setLayout(new GridBagLayout());
	this.objGjWindow.add(objLjPanel, new ExtendedGridBagConstraints(1, 1, 1, 1, GridBagConstraints.CENTER, 5, 5, 0, 0, 0, 0));
}
 
Example 18
Project: TrabalhoFinalEDA2   File: mxCellEditor.java   View Source Code Vote up 4 votes
public void startEditing(Object cell, EventObject evt)
{
	if (editingCell != null)
	{
		stopEditing(true);
	}

	mxCellState state = graphComponent.getGraph().getView().getState(cell);

	if (state != null)
	{
		editingCell = cell;
		trigger = evt;

		double scale = Math.max(minimumEditorScale, graphComponent
				.getGraph().getView().getScale());
		scrollPane.setBounds(getEditorBounds(state, scale));
		scrollPane.setVisible(true);

		String value = getInitialValue(state, evt);
		JTextComponent currentEditor = null;

		// Configures the style of the in-place editor
		if (graphComponent.getGraph().isHtmlLabel(cell))
		{
			if (isExtractHtmlBody())
			{
				value = mxUtils.getBodyMarkup(value,
						isReplaceHtmlLinefeeds());
			}

			editorPane.setDocument(mxUtils.createHtmlDocumentObject(
					state.getStyle(), scale));
			editorPane.setText(value);

			// Workaround for wordwrapping in editor pane
			// FIXME: Cursor not visible at end of line
			JPanel wrapper = new JPanel(new BorderLayout());
			wrapper.setOpaque(false);
			wrapper.add(editorPane, BorderLayout.CENTER);
			scrollPane.setViewportView(wrapper);

			currentEditor = editorPane;
		}
		else
		{
			textArea.setFont(mxUtils.getFont(state.getStyle(), scale));
			Color fontColor = mxUtils.getColor(state.getStyle(),
					mxConstants.STYLE_FONTCOLOR, Color.black);
			textArea.setForeground(fontColor);
			textArea.setText(value);

			scrollPane.setViewportView(textArea);
			currentEditor = textArea;
		}

		graphComponent.getGraphControl().add(scrollPane, 0);

		if (isHideLabel(state))
		{
			graphComponent.redraw(state);
		}

		currentEditor.revalidate();
		currentEditor.requestFocusInWindow();
		currentEditor.selectAll();

		configureActionMaps();
	}
}
 
Example 19
Project: incubator-netbeans   File: DemoPanel.java   View Source Code Vote up 4 votes
@Override
protected Component createFeedItemComponent(FeedItem item) {
    JPanel panel = new JPanel( new GridBagLayout() );
    panel.setOpaque(false);
    int row = 0;

    if( item.isValid() ) {
        if( item.enclosureUrl != null ) {
            panel.add( new ImageLabel( item.link, getImage( item.enclosureUrl ), item.description ),
                    new GridBagConstraints(0,row++,1,1,0.0,0.0,
                    GridBagConstraints.WEST,GridBagConstraints.NONE,
                    new Insets(0,0,5,5),0,0 ) );
        } else {
            JLabel label = new JLabel( BundleSupport.getLabel("NoScreenShot") ); //NOI18N
            label.setHorizontalAlignment( JLabel.CENTER );
            label.setVerticalAlignment( JLabel.CENTER );
            panel.add( label, new GridBagConstraints(0,row++,1,1,0.0,0.0,
                    GridBagConstraints.CENTER,GridBagConstraints.NONE,
                    new Insets(0,0,5,5),0,0 ) );
        }

        WebLink linkButton = new WebLink( item.title, item.link, false );
        linkButton.getAccessibleContext().setAccessibleName(
                BundleSupport.getAccessibilityName( "WebLink", item.title ) ); //NOI18N
        linkButton.getAccessibleContext().setAccessibleDescription(
                BundleSupport.getAccessibilityDescription( "WebLink", item.link ) ); //NOI18N
        linkButton.setFont( BUTTON_FONT );
        panel.add( linkButton, new GridBagConstraints(0,row++,1,1,0.0,0.0,
                GridBagConstraints.WEST,GridBagConstraints.NONE,
                new Insets(0,0,5,5),0,0 ) );
    } else {
        panel.add( new JLabel(BundleSupport.getLabel("ErrLoadingFeed")),  // NOI18N
                new GridBagConstraints(0,row++,1,1,0.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
        JButton button = new JButton();
        Mnemonics.setLocalizedText( button, BundleSupport.getLabel( "Reload" ) );  // NOI18N
        button.setOpaque( false );
        button.addActionListener( new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                lastReload = 0;
                reload();
            }
        });
        panel.add( button, new GridBagConstraints(0,row++,1,1,0.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    }
    
    return panel;
}
 
Example 20
Project: incubator-netbeans   File: InstancesControllerUI.java   View Source Code Vote up 4 votes
private void initComponents() {
    JPanel fieldsBrowserPanel = instancesController.getFieldsBrowserController().getPanel();
    JPanel referencesBrowserPanel = instancesController.getReferencesBrowserController().getPanel();
    JPanel instancesListPanel = instancesController.getInstancesListController().getPanel();

    browsersSplit = new JExtendedSplitPane(JSplitPane.VERTICAL_SPLIT, fieldsBrowserPanel, referencesBrowserPanel);
    tweakSplitPaneUI(browsersSplit);
    browsersSplit.setResizeWeight(0.5d);

    contentsSplit = new JExtendedSplitPane(JSplitPane.HORIZONTAL_SPLIT, instancesListPanel, browsersSplit);
    tweakSplitPaneUI(contentsSplit);
    contentsSplit.setDividerLocation(instancesListPanel.getPreferredSize().width);

    JPanel classPresenterPanel = instancesController.getClassPresenterPanel();
    classPresenterPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 3, 0,
                                                                                                     getBackground()),
                                                                     classPresenterPanel.getBorder()));

    legendPanel = new LegendPanel(true);

    dataPanel = new JPanel(new BorderLayout());
    dataPanel.setOpaque(false);
    dataPanel.add(classPresenterPanel, BorderLayout.NORTH);
    dataPanel.add(contentsSplit, BorderLayout.CENTER);
    dataPanel.add(legendPanel, BorderLayout.SOUTH);

    noDataPanel = new JPanel(new BorderLayout());
    noDataPanel.setBorder(BorderFactory.createLoweredBevelBorder());

    HTMLTextArea hintArea = new HTMLTextArea() {
        protected void showURL(URL url) {
            instancesController.getHeapFragmentWalker().switchToClassesView();
        }
    };

    hintArea.setBorder(BorderFactory.createEmptyBorder(10, 8, 8, 8));

    String classesRes = Icons.getResource(LanguageIcons.CLASS);
    String hintText = Bundle.InstancesControllerUI_NoClassDefinedMsg(
                        "<a href='#'><img border='0' align='bottom' src='nbresloc:/" + classesRes + "'></a>"); // NOI18N
    hintArea.setText(hintText);
    noDataPanel.add(hintArea, BorderLayout.CENTER);

    contents = new CardLayout();
    setLayout(contents);
    add(noDataPanel, NO_DATA);
    add(dataPanel, DATA);

    LegendUpdater legendUpdater = new LegendUpdater();
    fieldsBrowserPanel.addHierarchyListener(legendUpdater);
    referencesBrowserPanel.addHierarchyListener(legendUpdater);
}