javax.swing.JTextPane#setForeground ( )源码实例Demo

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

源代码1 项目: stendhal   文件: InformationPanel.java
/**
 * Create a new InformationPanel.
 */
InformationPanel() {
	setLayout(new OverlayLayout(this));
	JComponent container = SBoxLayout.createContainer(SBoxLayout.VERTICAL);
	glassPane = new JComponent(){};
	add(glassPane);
	add(container);

	// ** Zone name **
	nameField = new JTextPane();
	StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
	nameField.setAlignmentX(CENTER_ALIGNMENT);
	nameField.setOpaque(true);
	nameField.setBackground(getBackground());
	nameField.setForeground(Color.WHITE);
	nameField.setFocusable(false);
	nameField.setEditable(false);
	container.add(nameField, SLayout.EXPAND_X);

	// ** Danger display **
	dangerIndicator = new DangerIndicator(MAX_SKULLS);
	dangerIndicator.setAlignmentX(CENTER_ALIGNMENT);
	container.add(dangerIndicator);
	// Default to safe, so that we always have a tooltip
	describeDanger(0);
}
 
源代码2 项目: netbeans   文件: NotifyExcPanel.java
/** Constructor.
*/
private NotifyExcPanel () {
    java.util.ResourceBundle bundle = org.openide.util.NbBundle.getBundle(NotifyExcPanel.class);
    next = new JButton ();
    Mnemonics.setLocalizedText(next, bundle.getString("CTL_NextException"));
    // bugfix 25684, don't set Previous/Next as default capable
    next.setDefaultCapable (false);
    previous = new JButton ();
    Mnemonics.setLocalizedText(previous, bundle.getString("CTL_PreviousException"));
    previous.setDefaultCapable (false);
    details = new JButton ();
    details.setDefaultCapable (false);

    output = new JTextPane() {
        public @Override boolean getScrollableTracksViewportWidth() {
            return false;
        }
    };
    output.setEditable(false);
    Font f = output.getFont();
    output.setFont(new Font("Monospaced", Font.PLAIN, null == f ? 12 : f.getSize() + 1)); // NOI18N
    output.setForeground(UIManager.getColor("Label.foreground")); // NOI18N
    output.setBackground(UIManager.getColor("Label.background")); // NOI18N

    setLayout( new BorderLayout() );
    add(new JScrollPane(output));
    setBorder( new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.LOWERED));
        
    next.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_NextException"));
    previous.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_PreviousException"));
    output.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_ExceptionStackTrace"));
    output.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_ExceptionStackTrace"));
    getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_NotifyExceptionPanel"));

    descriptor = new DialogDescriptor ("", ""); // NOI18N

    descriptor.setMessageType (DialogDescriptor.ERROR_MESSAGE);
    descriptor.setOptions (computeOptions(previous, next));
    descriptor.setAdditionalOptions (new Object[] {
                                         details
                                     });
    descriptor.setClosingOptions (new Object[0]);
    descriptor.setButtonListener (this);

    // bugfix #27176, create dialog in modal state if some other modal
    // dialog is opened at the time
    // #53328 do not let the error dialog to be created modal unless the main
    // window is visible. otherwise the error message may be hidden behind
    // the main window thus making the main window unusable
    descriptor.setModal( isModalDialogPresent() 
            && WindowManager.getDefault().getMainWindow().isVisible() );
    
    setPreferredSize(new Dimension(SIZE_PREFERRED_WIDTH + extraW, SIZE_PREFERRED_HEIGHT + extraH));

    dialog = DialogDisplayer.getDefault().createDialog(descriptor);
    if( null != lastBounds ) {
        lastBounds.width = Math.max( lastBounds.width, SIZE_PREFERRED_WIDTH+extraW );
        dialog.setBounds( lastBounds );
    }
    
    dialog.getAccessibleContext().setAccessibleName(bundle.getString("ACN_NotifyExcPanel_Dialog")); // NOI18N
    dialog.getAccessibleContext().setAccessibleDescription(bundle.getString("ACD_NotifyExcPanel_Dialog")); // NOI18N
}
 
源代码3 项目: WorldGrower   文件: JTextPaneFactory.java
private static void setTextPaneProperties(JTextPane textPane) {
	textPane.setBackground(ColorPalette.DARK_BACKGROUND_COLOR);
	textPane.setForeground(ColorPalette.FOREGROUND_COLOR);
	textPane.setFont(Fonts.FONT);
}
 
源代码4 项目: whyline   文件: BreakpointConsoleUI.java
public BreakpointConsoleUI(WhylineUI whylineUI) {
	
	this.whylineUI = whylineUI;

	setBorder(new WhylineControlBorder());

	console = new JTextPane() {
		public boolean getScrollableTracksViewportWidth() { return false; }
	};
	console.setBackground(UI.getConsoleBackColor());
	console.setForeground(UI.getConsoleTextColor());
	console.setFont(UI.getFixedFont());
	console.setEditable(false);
	
	console.setBackground(UI.getControlBackColor());
	console.setOpaque(true);

	debugAttributes = new SimpleAttributeSet();
	StyleConstants.setItalic(debugAttributes, false);
	StyleConstants.setForeground(debugAttributes, UI.getConsoleTextColor());

	regularAttributes = new SimpleAttributeSet();
	StyleConstants.setItalic(regularAttributes, false);
	StyleConstants.setForeground(regularAttributes, UI.getConsoleTextColor());

	setLayout(new BorderLayout(0, UI.getPanelPadding()));

	add(new WhylineScrollPane(console), BorderLayout.CENTER);

	setPreferredSize(new Dimension(0, UI.getDefaultInfoPaneHeight(whylineUI)));
	
	clear();
	
}