本文整理汇总了Java中java.awt.TextArea.setFont方法的典型用法代码示例。如果您正苦于以下问题:Java TextArea.setFont方法的具体用法?Java TextArea.setFont怎么用?Java TextArea.setFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.TextArea
的用法示例。
在下文中一共展示了TextArea.setFont方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initGUI
import java.awt.TextArea; //导入方法依赖的package包/类
private void initGUI() {
Panel pQuery = new Panel();
Panel pCommand = new Panel();
pResult = new Panel();
pQuery.setLayout(new BorderLayout());
pCommand.setLayout(new BorderLayout());
pResult.setLayout(new BorderLayout());
Font fFont = new Font("Dialog", Font.PLAIN, 12);
txtCommand = new TextArea(5, 40);
txtCommand.addKeyListener(this);
txtResult = new TextArea(20, 40);
txtCommand.setFont(fFont);
txtResult.setFont(new Font("Courier", Font.PLAIN, 12));
butExecute = new Button("Execute");
butClear = new Button("Clear");
butExecute.addActionListener(this);
butClear.addActionListener(this);
pCommand.add("East", butExecute);
pCommand.add("West", butClear);
pCommand.add("Center", txtCommand);
gResult = new Grid();
setLayout(new BorderLayout());
pResult.add("Center", gResult);
pQuery.add("North", pCommand);
pQuery.add("Center", pResult);
fMain.add("Center", pQuery);
tTree = new Tree();
// (ulrivo): screen with less than 640 width
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
if (d.width >= 640) {
tTree.setMinimumSize(new Dimension(200, 100));
} else {
tTree.setMinimumSize(new Dimension(80, 100));
}
gResult.setMinimumSize(new Dimension(200, 300));
fMain.add("West", tTree);
doLayout();
fMain.pack();
}
示例2: initGUI
import java.awt.TextArea; //导入方法依赖的package包/类
/**
* Method declaration
*
*/
private void initGUI() {
Panel pQuery = new Panel();
Panel pCommand = new Panel();
// define a Panel pCard which takes four different cards/views:
// tree of tables, command SQL text area, result window and an editor/input form
pCard = new Panel();
layoutCard = new CardLayout(2, 2);
pCard.setLayout(layoutCard);
// four buttons at the top to quickly switch between the four views
butTree = new Button("Tree");
butCommand = new Button("Command");
butResult = new Button("Result");
butEditor = new Button("Editor");
butTree.addActionListener(this);
butCommand.addActionListener(this);
butResult.addActionListener(this);
butEditor.addActionListener(this);
Panel pButtons = new Panel();
pButtons.setLayout(new GridLayout(1, 4, 8, 8));
pButtons.add(butTree);
pButtons.add(butCommand);
pButtons.add(butResult);
pButtons.add(butEditor);
pResult = new Panel();
pQuery.setLayout(new BorderLayout());
pCommand.setLayout(new BorderLayout());
pResult.setLayout(new BorderLayout());
Font fFont = new Font("Dialog", Font.PLAIN, 12);
txtCommand = new TextArea(5, 40);
txtCommand.addKeyListener(this);
txtResult = new TextArea(20, 40);
txtCommand.setFont(fFont);
txtResult.setFont(new Font("Courier", Font.PLAIN, 12));
butExecute = new Button("Execute");
butExecute.addActionListener(this);
pCommand.add("South", butExecute);
pCommand.add("Center", txtCommand);
gResult = new Grid();
setLayout(new BorderLayout());
pResult.add("Center", gResult);
tTree = new Tree();
tTree.setMinimumSize(new Dimension(200, 100));
gResult.setMinimumSize(new Dimension(200, 300));
eEditor = new ZaurusEditor();
pCard.add("tree", tTree);
pCard.add("command", pCommand);
pCard.add("result", pResult);
pCard.add("editor", eEditor);
fMain.add("Center", pCard);
fMain.add("North", pButtons);
doLayout();
fMain.pack();
}
示例3: initGUI
import java.awt.TextArea; //导入方法依赖的package包/类
/**
* Method declaration
*
*/
private void initGUI() {
Panel pQuery = new Panel();
Panel pCommand = new Panel();
pResult = new Panel();
pQuery.setLayout(new BorderLayout());
pCommand.setLayout(new BorderLayout());
pResult.setLayout(new BorderLayout());
Font fFont = new Font("Dialog", Font.PLAIN, 12);
txtCommand = new TextArea(5, 40);
txtCommand.addKeyListener(this);
txtResult = new TextArea(20, 40);
txtCommand.setFont(fFont);
txtResult.setFont(new Font("Courier", Font.PLAIN, 12));
butExecute = new Button("Execute");
butClear = new Button("Clear");
butExecute.addActionListener(this);
butClear.addActionListener(this);
pCommand.add("East", butExecute);
pCommand.add("West", butClear);
pCommand.add("Center", txtCommand);
gResult = new Grid();
setLayout(new BorderLayout());
pResult.add("Center", gResult);
pQuery.add("North", pCommand);
pQuery.add("Center", pResult);
fMain.add("Center", pQuery);
tTree = new Tree();
// (ulrivo): screen with less than 640 width
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
if (d.width >= 640) {
tTree.setMinimumSize(new Dimension(200, 100));
} else {
tTree.setMinimumSize(new Dimension(80, 100));
}
gResult.setMinimumSize(new Dimension(200, 300));
fMain.add("West", tTree);
doLayout();
fMain.pack();
}
示例4: initGUI
import java.awt.TextArea; //导入方法依赖的package包/类
/**
* Create the graphical user interface. This is AWT code.
*/
private void initGUI() {
// all panels
Panel pQuery = new Panel();
Panel pCommand = new Panel();
Panel pButton = new Panel();
Panel pRecent = new Panel();
Panel pResult = new Panel();
Panel pBorderWest = new Panel();
Panel pBorderEast = new Panel();
Panel pBorderSouth = new Panel();
pQuery.setLayout(new BorderLayout());
pCommand.setLayout(new BorderLayout());
pButton.setLayout(new BorderLayout());
pRecent.setLayout(new BorderLayout());
pResult.setLayout(new BorderLayout());
pBorderWest.setBackground(SystemColor.control);
pBorderSouth.setBackground(SystemColor.control);
pBorderEast.setBackground(SystemColor.control);
// labels
Label lblCommand = new Label(" Command", Label.LEFT);
Label lblRecent = new Label(" Recent", Label.LEFT);
Label lblResult = new Label(" Result", Label.LEFT);
lblCommand.setBackground(SystemColor.control);
lblRecent.setBackground(SystemColor.control);
lblResult.setBackground(SystemColor.control);
// buttons
butExecute = new Button("Execute");
butScript = new Button("Script");
butImport = new Button("Import");
pButton.add("South", butScript);
pButton.add("Center", butExecute);
pButton.add("North", butImport);
// command - textarea
Font fFont = new Font("Dialog", Font.PLAIN, 12);
txtCommand = new TextArea(5, 40);
txtCommand.setFont(fFont);
// recent - choice
choRecent = new Choice();
// result - grid
gResult = new Grid();
// combine it
setLayout(new BorderLayout());
pRecent.add("Center", choRecent);
pRecent.add("North", lblRecent);
pCommand.add("North", lblCommand);
pCommand.add("East", pButton);
pCommand.add("Center", txtCommand);
pCommand.add("South", pRecent);
pResult.add("North", lblResult);
pResult.add("Center", gResult);
pQuery.add("North", pCommand);
pQuery.add("Center", pResult);
add("Center", pQuery);
add("West", pBorderWest);
add("East", pBorderEast);
add("South", pBorderSouth);
// [email protected] 20011210 - patch 450412 by [email protected]
doLayout();
}