2021-04-26 (月) 18:08:39
テスト
// -*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
// @homepage@
package example;
import java.awt.*;
import java.awt.font.FontRenderContext;
import java.util.stream.Stream;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
public final class MainPanel extends JPanel {
private MainPanel() {
super(new BorderLayout());
int code = 0x1F512;
JLabel label = new JLabel(new String(Character.toChars(code)));
label.setFont(label.getFont().deriveFont(24f));
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setVerticalAlignment(SwingConstants.CENTER);
String[] columnNames = {"family", "name", "postscript name", "canDisplay", "isEmpty"};
DefaultTableModel model = new DefaultTableModel(null, columnNames) {
@Override public boolean isCellEditable(int row, int column) {
return false;
}
@Override public Class<?> getColumnClass(int column) {
return column > 2 ? Boolean.class : String.class;
}
};
JTable table = new JTable(model);
Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
Stream.of(fonts)
.map(f -> {
String txt = new String(Character.toChars(code));
FontRenderContext frc = getFontMetrics(f).getFontRenderContext();
return new Object[] {
f.getFamily(),
f.getName(),
f.getPSName(),
f.canDisplay(code),
f.createGlyphVector(frc, txt).getVisualBounds().isEmpty()
};
})
.forEach(model::addRow);
add(new JScrollPane(table));
table.getSelectionModel().addListSelectionListener(e -> {
int sc = table.getSelectedRowCount();
if (!e.getValueIsAdjusting() && sc == 1) {
Font f = fonts[table.getSelectedRow()];
label.setFont(f.deriveFont(24f));
}
});
add(label, BorderLayout.NORTH);
add(new JScrollPane(table));
setPreferredSize(new Dimension(320, 240));
}
public static void main(String[] args) {
EventQueue.invokeLater(MainPanel::createAndShowGui);
}
private static void createAndShowGui() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
ex.printStackTrace();
Toolkit.getDefaultToolkit().beep();
}
JFrame frame = new JFrame("@title@");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.getContentPane().add(new MainPanel());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
リンク
- Swing [Archive] - How can I open a JFrame at the center of my screen ?
[[Swing [Archive] - How can I open a JFrame at the center of my screen ?>https://forums.oracle.com/thread/1484432]]
- Swing [Archive - How can I open a JFrame at the center of my screen ?]
[https://forums.oracle.com/thread/1484432 Swing [Archive] - How can I open a JFrame at the center of my screen ?]
- Swing/_ScreenShots
- 全ページの一覧
- 最近の更新ページ
メモ
git merge でエディタを開かない
- Git merge doesn't use default merge message, opens editor with default message - Stack Overflow
export GIT_MERGE_AUTOEDIT=no
- .gitconfig
[core] mergeoptions = --no-edit
git merge --no-edit
VirtualBoxでの半角/全角キーリピートバグ
VirtualBox
+ Ubuntu
や、Linux mint 14
で日本語入力の切り替えに半角/全角キーを使うと、システムトレイのアイコンが点滅する(うまく切り替えられない)。
echo "/usr/bin/xset -r 49" | sudo tee -a /etc/X11/Xsession.d/98vboxadd-xclient
段組
てすと 自由に書き込みなどのテストしてください。このページは、時々内容を初期化しています。 自由に書き込みなどのテストしてください。このページは、時々内容を初期化しています。 自由に書き込みなどのテストしてください。このページは、時々内容を初期化しています。 自由に書き込みなどのテストしてください。このページは、時々内容を初期化しています。 自由に書き込みなどのテストしてください。このページは、時々内容を初期化しています。
2: 自由に書き込みなどのテストしてください。このページは、時々内容を初期化しています。 自由に書き込みなどのテストしてください。このページは、時々内容を初期化しています。 自由に書き込みなどのテストしてください。このページは、時々内容を初期化しています。
3: 自由に書き込みなどのテストしてください。このページは、時々内容を初期化しています。 自由に書き込みなどのテストしてください。このページは、時々内容を初期化しています。 自由に書き込みなどのテストしてください。このページは、時々内容を初期化しています。
コメント
- subversionのセットアップ情報参考にさせていただいています。ありがとうございます。 --
- どうもです(二ヶ月気づいてませんでした (^^;)。 -- aterai
- できない -- 投稿