我使用JFontChooser
为文本区域选择字体。我已将JPanel
添加到字体选择器中,该JPanel
位于包含文本区域的另一个topPanel
上方。问题是,如果字体大小太大,字体选择器的预览窗口部分会调整整个内容的大小,占用空间。我尝试在包含字体选择器的面板上强制最大尺寸,但无济于事。
midPanel
包含字体选择器和按钮; textArea
包含public TextEditorWindow(IConnector connect, FolderSearchComp fs, GuiConstructor gui, LoopControlWindow loopc) {
this.connect = connect;
this.fs = fs;
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.gui = gui;
font = fs.getFormatFont();
this.loopc = loopc;
initComps();
size = new Dimension(610, Toolkit.getDefaultToolkit().getScreenSize().height - 100);
}
private void createTopPanel() {
topPanel = new JPanel();
topPanel.setLayout(new BorderLayout());
applyButton = new JButton("Apply Font");
applyButton.addActionListener(this);
applyButton.setAlignmentX(Component.RIGHT_ALIGNMENT);
fc = new JFontChooser();
fc.setAlignmentX(RIGHT_ALIGNMENT);
fc.setSelectedFont(font);
topPanel.setBorder(BorderFactory.createTitledBorder("Choose a font"));
topPanel.add(fc, BorderLayout.CENTER);
topPanel.add(applyButton, BorderLayout.SOUTH);
topPanel.setMaximumSize(new Dimension(600,300));
}
private void createMidPanel() {
midPanel = new JPanel();
midPanel.setLayout(new BorderLayout());
textArea = new JTextArea(20,20);
textArea.setWrapStyleWord(true);
textArea.setLineWrap(true);
JScrollPane scroll = new JScrollPane();
scroll.setViewportView(textArea);
scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
midPanel.add(scroll, BorderLayout.CENTER);
}
。
db.nodes.aggregate([
{"$group": {"_id": "$VARIENTS.NAME"}},
{"$project": {"_id": 0, "TEMPLATE_NAME": "$_id"}}
]);
以下是应用程序所需的默认字体大小的图片。
这里的字体非常大。