backGround Color を使用して JTextPane 内に JLabel を作成していましたが、コードでサイズを変更してsetSize , setPrefferedSize
再検証しようとすると、両方とも機能しませんでした。Jlabelの幅をすべて130、高さ20にしたい。
それを行う別の方法はありますか?
これが私のコードです
final JLabel jl = new JLabel(rs2.getString("username"));
final String username = rs2.getString("username");
Border d = BorderFactory.createEmptyBorder(1,10,1,10);
Border d2 = BorderFactory.createLineBorder(Color.BLACK);
Border d3 = BorderFactory.createCompoundBorder(d2,d);
jl.setPreferredSize(new Dimension(130,20));
jl.setFont(new Font("Calibri",Font.BOLD,16));
jl.setBorder(d3);
jl.setOpaque(true);
jl.setBackground(Color.ORANGE);
Cursor c = new Cursor(Cursor.HAND_CURSOR);
jl.setCursor(c);
jl.revalidate();
jtp.insertComponent(jl);
sd.insertString(sd.getLength(), "\n", SubPanel1.sas);