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

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

源代码1 项目: zap-extensions   文件: ExtensionSimpleExample.java
private AbstractPanel getStatusPanel() {
    if (statusPanel == null) {
        statusPanel = new AbstractPanel();
        statusPanel.setLayout(new CardLayout());
        statusPanel.setName(Constant.messages.getString(PREFIX + ".panel.title"));
        statusPanel.setIcon(ICON);
        JTextPane pane = new JTextPane();
        pane.setEditable(false);
        // Obtain (and set) a font with the size defined in the options
        pane.setFont(FontUtils.getFont("Dialog", Font.PLAIN));
        pane.setContentType("text/html");
        pane.setText(Constant.messages.getString(PREFIX + ".panel.msg"));
        statusPanel.add(pane);
    }
    return statusPanel;
}
 
源代码2 项目: bigtable-sql   文件: LineNumber.java
public static void main(String[] args)
{
	JFrame frame = new JFrame("LineNumberDemo");
	frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );

	JPanel panel = new JPanel();
	frame.setContentPane( panel );
	panel.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
	panel.setLayout(new BorderLayout());

	JTextPane textPane = new JTextPane();
	textPane.setFont( new Font("monospaced", Font.PLAIN, 12) );
	textPane.setText("abc");

	JScrollPane scrollPane = new JScrollPane(textPane);
	panel.add(scrollPane);
	scrollPane.setPreferredSize(new Dimension(300, 250));

	LineNumber lineNumber = new LineNumber( textPane );
	scrollPane.setRowHeaderView( lineNumber );

	frame.pack();
	frame.setVisible(true);
}
 
源代码3 项目: atdl4j   文件: SwingStrategyDescriptionPanel.java
public JPanel buildStrategyDescriptionPanel(Window aParentContainer,
                                            Atdl4jOptions atdl4jOptions)
{
  setAtdl4jOptions(atdl4jOptions);

  container = new JPanel(new BorderLayout());
  container.setBorder(new TitledBorder("Strategy Description"));

  strategyDescription = new JTextPane();
  strategyDescription.setContentType("text/html");
  strategyDescription.setFont(new JLabel().getFont());
  strategyDescription.setEditable(false);

  JScrollPane tempScrollPane = new JScrollPane(strategyDescription);
  container.add(tempScrollPane, BorderLayout.CENTER);

  return container;
}
 
/**
 * Create the frame.
 */
public LicenseWindow(final String path) {
	
	setTitle("Coder HPMSA - [License]");
	setBounds(100, 100, 550, 550);
	setBackground(Color.decode("#066d95"));
	setLocationRelativeTo(null);
	setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	
	this.setIconImage(Toolkit.getDefaultToolkit().
			getImage(getClass().getResource(LOGOPATH)));
	
	final JScrollPane scrollPane = new JScrollPane();
	scrollPane.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
	getContentPane().add(scrollPane, BorderLayout.CENTER);
	
	editorPane = new JTextPane();
	editorPane.setBackground(new Color(255, 255, 240));
	editorPane.setFont(new Font("Verdana", Font.PLAIN, 13));
	editorPane.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
	editorPane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
	editorPane.setEditable(false);
	scrollPane.setViewportView(editorPane);
	
	final StyledDocument doc = editorPane.getStyledDocument();
	final SimpleAttributeSet center = new SimpleAttributeSet();
	StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
	doc.setParagraphAttributes(0, doc.getLength()-1, center, false);
	
	fillEditorPane(path);
	setVisible(true);
}
 
public ConsolePanel() {
    setLayout(new BorderLayout());
    consoleView = new JTextPane();
    consoleView.setEditable(false);
    consoleView.setFont(FONT);
    add(new JScrollPane(consoleView), BorderLayout.CENTER);
}
 
源代码6 项目: rapidminer-studio   文件: ROCViewer.java
public ROCViewer(AreaUnderCurve auc) {
	setLayout(new BorderLayout());

	String message = auc.toString();

	criterionName = auc.getName();

	// info string
	JPanel infoPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
	infoPanel.setOpaque(true);
	infoPanel.setBackground(Colors.WHITE);
	JTextPane infoText = new JTextPane();
	infoText.setEditable(false);
	infoText.setBackground(infoPanel.getBackground());
	infoText.setFont(infoText.getFont().deriveFont(Font.BOLD));
	infoText.setText(message);
	infoPanel.add(infoText);
	add(infoPanel, BorderLayout.NORTH);

	// plot panel
	plotter = new ROCChartPlotter();
	plotter.addROCData("ROC", auc.getRocData());
	JPanel innerPanel = new JPanel(new BorderLayout());
	innerPanel.add(plotter, BorderLayout.CENTER);
	innerPanel.setBorder(BorderFactory.createMatteBorder(5, 0, 10, 10, Colors.WHITE));
	add(innerPanel, BorderLayout.CENTER);
}
 
源代码7 项目: zap-extensions   文件: ClientsPanel.java
private JTextPane getInitialMessage() {
    JTextPane initialMessage = new JTextPane();
    initialMessage.setEditable(false);
    initialMessage.setFont(FontUtils.getFont("Dialog"));
    initialMessage.setContentType("text/html");
    initialMessage.setText(Constant.messages.getString("plugnhack.label.initialMessage"));
    return initialMessage;
}
 
源代码8 项目: wandora   文件: ApplicationXML.java
@Override
protected JComponent getTextComponent(String locator) throws Exception {
    JTextPane textComponent = new JTextPane();
    textComponent.setText(getContent(locator));
    textComponent.setFont(new Font("monospaced", Font.PLAIN, 12));
    textComponent.setEditable(false);
    textComponent.setCaretPosition(0);
    textComponent.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
    return textComponent;
}
 
源代码9 项目: chipster   文件: TextViewer.java
public static JTextPane makeTxtPane(String txt) {
	JTextPane txtPane = new JTextPane();
	txtPane.setFont(Font.decode("Monospaced"));
	txtPane.setText(txt);
	txtPane.setEditable(false);
	return txtPane;
}
 
源代码10 项目: 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
}
 
源代码11 项目: netbeans   文件: ProjectFolder.java
/** This method is called from within the constructor to
 * initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    projectFolderCheckBox = new JCheckBox();
    projectFolderLabel = new JLabel();
    projectFolderTextField = new JTextField();
    projectFolderBrowseButton = new JButton();
    projectFolderScrollPane = new JScrollPane();
    projectFolderTextPane = new JTextPane();

    Mnemonics.setLocalizedText(projectFolderCheckBox, NbBundle.getMessage(ProjectFolder.class, "LBL_SeparateProjectFolder")); // NOI18N

    projectFolderLabel.setLabelFor(projectFolderTextField);
    Mnemonics.setLocalizedText(projectFolderLabel, NbBundle.getMessage(ProjectFolder.class, "LBL_MetadataFolder")); // NOI18N
    projectFolderLabel.setEnabled(false);

    projectFolderTextField.setColumns(20);
    projectFolderTextField.setEnabled(false);

    Mnemonics.setLocalizedText(projectFolderBrowseButton, NbBundle.getMessage(ProjectFolder.class, "LBL_BrowseProject")); // NOI18N
    projectFolderBrowseButton.setEnabled(false);
    projectFolderBrowseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            projectFolderBrowseButtonActionPerformed(evt);
        }
    });

    projectFolderScrollPane.setBorder(null);

    projectFolderTextPane.setBackground(UIManager.getDefaults().getColor("Label.background"));
    projectFolderTextPane.setBorder(null);
    projectFolderTextPane.setFont(new Font("Dialog", 1, 12)); // NOI18N
    projectFolderTextPane.setText(NbBundle.getMessage(ProjectFolder.class, "TXT_MetadataInfo")); // NOI18N
    projectFolderScrollPane.setViewportView(projectFolderTextPane);
    projectFolderTextPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderTextPane.AccessibleContext.accessibleName")); // NOI18N
    projectFolderTextPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderTextPane.AccessibleContext.accessibleDescription")); // NOI18N

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(Alignment.LEADING)
        .addGroup(Alignment.TRAILING, layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                .addComponent(projectFolderCheckBox)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(projectFolderLabel)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(projectFolderTextField, GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addComponent(projectFolderBrowseButton))
        .addComponent(projectFolderScrollPane, GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addComponent(projectFolderCheckBox)
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                .addComponent(projectFolderTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(projectFolderLabel)
                .addComponent(projectFolderBrowseButton))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addComponent(projectFolderScrollPane))
    );

    projectFolderCheckBox.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderCheckBox.AccessibleContext.accessibleName")); // NOI18N
    projectFolderCheckBox.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderCheckBox.AccessibleContext.accessibleDescription")); // NOI18N
    projectFolderLabel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderLabel.AccessibleContext.accessibleName")); // NOI18N
    projectFolderLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderLabel.AccessibleContext.accessibleDescription")); // NOI18N
    projectFolderTextField.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderTextField.AccessibleContext.accessibleName")); // NOI18N
    projectFolderTextField.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderTextField.AccessibleContext.accessibleDescription")); // NOI18N
    projectFolderBrowseButton.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderBrowseButton.AccessibleContext.accessibleName")); // NOI18N
    projectFolderBrowseButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderBrowseButton.AccessibleContext.accessibleDescription")); // NOI18N
    projectFolderScrollPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderScrollPane1.AccessibleContext.accessibleName")); // NOI18N
    projectFolderScrollPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderScrollPane1.AccessibleContext.accessibleDescription")); // NOI18N

    getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.AccessibleContext.accessibleName")); // NOI18N
    getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.AccessibleContext.accessibleDescription")); // NOI18N
}
 
/**
 * Create the frame.
 */
public ReadLogsWindow() {
	
	setTitle("Coder HPMSA - [Read Logs]");
	setBounds(100, 100, 660, 550);
	setBackground(Color.decode("#066d95"));
	setLocationRelativeTo(null);
	setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	
	this.setIconImage(Toolkit.getDefaultToolkit().
			getImage(getClass().getResource(LOGOPATH)));
	
	final JScrollPane scrollPane = new JScrollPane();
	scrollPane.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
	getContentPane().add(scrollPane, BorderLayout.CENTER);
	
	editorPane = new JTextPane();
	editorPane.setBackground(new Color(255, 255, 240));
	editorPane.setFont(new Font("Verdana", Font.PLAIN, 13));
	editorPane.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
	editorPane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
	editorPane.setEditable(false);
	scrollPane.setViewportView(editorPane);
	
	final JPanel filesPanel = new JPanel();
	filesPanel.setPreferredSize(new Dimension(200, 10));
	getContentPane().add(filesPanel, BorderLayout.EAST);
	filesPanel.setLayout(new BorderLayout(0, 0));
	
	final JScrollPane listScrollPane = new JScrollPane();
	listScrollPane.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
	listScrollPane.setViewportView(logFilesList());
	filesPanel.add(listScrollPane, BorderLayout.CENTER);
	
	final JPanel titlePanel = new JPanel();
	titlePanel.setPreferredSize(new Dimension(10, 40));
	titlePanel.setBackground(Color.decode("#066d95"));
	titlePanel.setAutoscrolls(true);
	getContentPane().add(titlePanel, BorderLayout.NORTH);
	titlePanel.setLayout(new BorderLayout(0, 0));
	
	final JLabel lblTitle = new JLabel("SYSTEM LOG RECORDS");
	lblTitle.setHorizontalTextPosition(SwingConstants.CENTER);
	lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
	lblTitle.setAutoscrolls(true);
	lblTitle.setFont(new Font("Verdana", Font.BOLD, 25));
	lblTitle.setForeground(UIManager.getColor("Button.highlight"));
	titlePanel.add(lblTitle, BorderLayout.CENTER);
	
	final StyledDocument doc = editorPane.getStyledDocument();
	final SimpleAttributeSet center = new SimpleAttributeSet();
	StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
	doc.setParagraphAttributes(0, doc.getLength(), center, false);
	
	setVisible(true);
}
 
源代码13 项目: org.alloytools.alloy   文件: SimpleGUI.java
/**
 * This method displays the about box.
 */
public Runner doAbout() {
    if (wrap)
        return wrapMe();

    // Old about message
    // OurDialog.showmsg("About Alloy Analyzer " + Version.version(), OurUtil.loadIcon("images/logo.gif"), "Alloy Analyzer " + Version.version(), "Build date: " + " git: " + Version.commit, " ", "Lead developer: Felix Chang", "Engine developer: Emina Torlak", "Graphic design: Julie Pelaez", "Project lead: Daniel Jackson", " ", "Please post comments and questions to the Alloy Community Forum at http://alloy.mit.edu/", " ", "Thanks to: Ilya Shlyakhter, Manu Sridharan, Derek Rayside, Jonathan Edwards, Gregory Dennis,", "Robert Seater, Edmond Lau, Vincent Yeung, Sam Daitch, Andrew Yip, Jongmin Baek, Ning Song,", "Arturo Arizpe, Li-kuo (Brian) Lin, Joseph Cohen, Jesse Pavel, Ian Schechter, and Uriel Schafer.");

    HTMLEditorKit kit = new HTMLEditorKit();
    StyleSheet styleSheet = kit.getStyleSheet();
    styleSheet.addRule("body {color:#000; font-family:Verdana, Trebuchet MS,Geneva, sans-serif; font-size: 10px; margin: 4px; }");
    styleSheet.addRule("h1 {color: blue;}");
    styleSheet.addRule("h2 {color: #ff0000;}");
    styleSheet.addRule("pre {font : 10px monaco; color : black; background-color: #C0C0C0; padding: 4px; margin: 4px; }");
    styleSheet.addRule("th {text-align:left;}");

    JTextPane ta = new JTextPane();
    ta.setEditorKit(kit);
    ta.setContentType("text/html");
    ta.setBackground(null);
    ta.setBorder(null);
    ta.setFont(new JLabel().getFont());
    // @formatter:off
    ta.setText("<html><h1>Alloy Analyzer " + Version.getShortversion() + "</h1>"
    + "<br/>"
    + "<html>"
    + "<tr><th>Project Lead</th><td>Daniel Jackson</td></tr>"
    + "<tr><th>Chief Developer</th><td>Aleksandar Milicevic</td></tr>"
    + "<tr><th>Kodkod Engine</th><td>Emina Torlak</td></tr>"
    + "<tr><th>Open Source</th><td>Peter Kriens</td></tr>"
    + "</table><br/>"
    + "<p>For more information about Alloy, <a href='http://alloytools.org'>http://alloytools.org</a></p>"
    + "<p>Questions and comments about Alloy are welcome at the community forum:</p>"
    + "<p>Alloy Community Forum: <a href='https://groups.google.com/forum/#!forum/alloytools'>https://groups.google.com/forum/#!forum/alloytools</a></p>"
    + "<p>Alloy experts also respond to <a href='https://stackoverflow.com/questions/tagged/alloy'>https://stackoverflow.com</a> questions tagged <code>alloy</code>.</p>"
    + "<p>Major contributions to earlier versions of Alloy were made by: Felix Chang (v4);<br/>"
    + "Jonathan Edwards, Eunsuk Kang, Joe Near, Robert Seater, Derek Rayside, Greg Dennis,<br/>"
    + "Ilya Shlyakhter, Mana Taghdiri, Mandana Vaziri, Sarfraz Khurshid (v3); Manu Sridharan<br/>"
    + "(v2); Edmond Lau, Vincent Yeung, Sam Daitch, Andrew Yip, Jongmin Baek, Ning Song,<br/>"
    + "Arturo Arizpe, Li-kuo (Brian) Lin, Joseph Cohen, Jesse Pavel, Ian Schechter, Uriel<br/>"
    + "Schafer (v1).</p>"
    + "<p>The development of Alloy was funded by part by the National Science Foundation under<br/>"
    + "Grant Nos. 0325283, 0541183, 0438897 and 0707612; by the Air Force Research Laboratory<br/>"
    + "(AFRL/IF) and the Disruptive Technology Office (DTO) in the National Intelligence<br/>"
    + "Community Information Assurance Research (NICIAR) Program; and by the Nokia<br/>"
    + "Corporation as part of a collaboration between Nokia Research and MIT CSAIL.</p>"
    + "<br/><pre>"
    + "Build Date: " + Version.buildDate() + "<br/>"
    + "Git Commit: " + Version.commit
    + "</pre>");
    // @formatter:on
    ta.setEditable(false);
    ta.addHyperlinkListener((e) -> {
        if (e.getEventType() == EventType.ACTIVATED) {
            if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
                try {
                    Desktop.getDesktop().browse(e.getURL().toURI());
                } catch (IOException | URISyntaxException e1) {
                    // ignore
                }
            }
        }
    });
    OurDialog.showmsg("About Alloy Analyzer " + Version.version(), ta);

    return null;
}
 
源代码14 项目: WorldGrower   文件: JTextPaneFactory.java
private static void setTextPaneProperties(JTextPane textPane) {
	textPane.setBackground(ColorPalette.DARK_BACKGROUND_COLOR);
	textPane.setForeground(ColorPalette.FOREGROUND_COLOR);
	textPane.setFont(Fonts.FONT);
}
 
源代码15 项目: COMP6237   文件: GroovyConsoleSlide.java
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BorderLayout());

	final JPanel controls = new JPanel();
	final JButton runBtn = new JButton("Run");
	runBtn.setActionCommand("run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	base.add(controls, BorderLayout.NORTH);

	textArea = new RSyntaxTextArea(20, 60);
	Font font = textArea.getFont();
	font = font.deriveFont(font.getStyle(), 18);
	textArea.setFont(font);
	textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_GROOVY);
	textArea.setCodeFoldingEnabled(true);

	textArea.setText(initialScript);

	final RTextScrollPane inputScrollPane = new RTextScrollPane(textArea);

	outputPane = new JTextPane();
	outputPane.setEditable(false);
	outputPane.setFont(new Font("Monospaced", Font.PLAIN, 18));
	outputPane.setBorder(new EmptyBorder(4, 4, 4, 4));
	final JScrollPane outputScrollPane = new JScrollPane(outputPane);

	splitPane = new JSplitPane(orientation, inputScrollPane, outputScrollPane);
	splitPane.setOneTouchExpandable(true);
	splitPane.setDividerLocation(width / 2);

	final Dimension minimumSize = new Dimension(100, 50);
	inputScrollPane.setMinimumSize(minimumSize);
	outputScrollPane.setMinimumSize(minimumSize);

	final JPanel body = new JPanel();
	body.setBackground(Color.RED);
	body.setLayout(new BoxLayout(body, BoxLayout.Y_AXIS));
	body.add(splitPane);
	base.add(body, BorderLayout.CENTER);

	installInterceptors();

	return base;
}
 
源代码16 项目: 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();
	
}