本文整理了Java中javax.swing.JFrame.setFont()
方法的一些代码示例,展示了JFrame.setFont()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.setFont()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:setFont
暂无
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame();
String string = "\u30b7\u30f3\u30d7\u30eb\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf";
JLabel label = new JLabel();
label.setFont(new Font("MS Mincho",Font.PLAIN, 12));
label.setText(string);
frame.getContentPane().add(label);
frame.setFont(new Font("MS Mincho",Font.PLAIN, 12));
frame.setTitle(string);
代码示例来源:origin: klamonte/jexer
/**
* Sets the font of this component.
*
* @param f the font to become this component's font; if this parameter
* is null then this component will inherit the font of its parent
*/
public void setFont(final Font f) {
if (frame != null) {
frame.setFont(f);
} else {
component.setFont(f);
}
}
代码示例来源:origin: stackoverflow.com
JFrame t = new JFrame();
t.setSize(600,300);
t.setFont(new Font("System", Font.PLAIN, 14));
Font f = t.getFont();
FontMetrics fm = t.getFontMetrics(f);
int x = fm.stringWidth("Hello Center");
int y = fm.stringWidth(" ");
int z = t.getWidth()/2 - (x/2);
int w = z/y;
String pad ="";
//for (int i=0; i!=w; i++) pad +=" ";
pad = String.format("%"+w+"s", pad);
t.setTitle(pad+"Hello Center");
代码示例来源:origin: stackoverflow.com
JFrame t = new JFrame();
t.setSize(600,300);
t.setFont(new Font("System", Font.PLAIN, 14));
Font f = t.getFont();
FontMetrics fm = t.getFontMetrics(f);
int x = fm.stringWidth("Hello Center");
int y = fm.stringWidth(" ");
int z = t.getWidth()/2 - (x/2);
int w = z/y;
String pad ="";
//for (int i=0; i!=w; i++) pad +=" ";
pad = String.format("%"+w+"s", pad);
t.setTitle(pad+"Hello Center");
代码示例来源:origin: Refinitiv/Elektron-SDK
NewsViewerFrame(int fontSize, String fontInput, NewsHandler MPHandler)
{
_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Font font = new Font(fontInput, Font.PLAIN, fontSize);
_frame.getFontMetrics(font);
_frame.setFont(font);
_frame.getContentPane().setLayout(new BoxLayout(_frame.getContentPane(), BoxLayout.Y_AXIS));
_storyViewer = new NewsStoryViewer(font);
_headlineViewer = new NewsHeadlineViewer(_storyViewer, font, MPHandler);
_frame.getContentPane().add(_headlineViewer.getFilterSelector().component());
_frame.getContentPane().add(_headlineViewer.component());
_frame.getContentPane().add(_storyViewer.component());
_frame.pack();
_frame.setVisible(true);
}
代码示例来源:origin: dhale/jtk
/**
* Sets the font in all components in this frame.
* @param font the font.
*/
public void setFont(Font font) {
super.setFont(font);
if (_panelMain==null) return;
_panelMain.setFont(font);
_panelTL.setFont(font);
if (_panelBR!=_panelTL)
_panelBR.setFont(font);
}
内容来源于网络,如有侵权,请联系作者删除!