我有一个问题,我的GridLayout修复了每个JLabel的大小。
JLabel的显示太小,无法显示对象(文本)。
这是我的代码的一部分 `
sjpc.add(changing01);sjpc.add(changing13);sjpc.add(changing25);
sjpc.add(changing02);sjpc.add(changing14);sjpc.add(changing26);
sjpc.add(changing03);sjpc.add(changing15);sjpc.add(changing27);
sjpc.add(changing04);sjpc.add(changing16);sjpc.add(changing28);
sjpc.add(changing05);sjpc.add(changing17);sjpc.add(changing29);
sjpc.add(changing06);sjpc.add(changing18);sjpc.add(changing30);
sjpc.add(changing07);sjpc.add(changing19);sjpc.add(changing31);
sjpc.add(changing08);sjpc.add(changing20);sjpc.add(changing32);
sjpc.add(changing09);sjpc.add(changing21);sjpc.add(changing33);
sjpc.add(changing10);sjpc.add(changing22);sjpc.add(changing34);
sjpc.add(changing11);sjpc.add(changing23);sjpc.add(changing35);
sjpc.add(changing12);sjpc.add(changing24);sjpc.add(changing36);
changing01.setText(txtf1.getText());
if(Searching.exists())
{
try
{
jfrm.setVisible(true);
ObjectInputStream reader = new ObjectInputStream(new FileInputStream(Searching));
reader.readObject();
for(int i = 0 ; i <13 ; i++)
{
if(i ==0)
{
Object bFile = reader.readObject();
changing03.setText(bFile.toString());
}
if(i ==1)
{
Object bFile = reader.readObject();
changing09.setText(bFile.toString());
}
if(i ==2)
{
Object bFile = reader.readObject();
changing04.setText(bFile.toString());
}
if(i ==3)
{
Object bFile = reader.readObject();
changing06.setText(bFile.toString());
}
if(i ==4)
{
Object bFile = reader.readObject();
changing18.setText(bFile.toString());
}
if(i ==5)
{
Object bFile = reader.readObject();
changing30.setText(bFile.toString());
}
if(i ==6)
{
Object bFile = reader.readObject();
changing07.setText(bFile.toString());
}
if(i ==7)
{
Object bFile = reader.readObject();
changing21.setText(bFile.toString());
}
if(i ==8)
{
Object bFile = reader.readObject();
changing10.setText(bFile.toString());
}
if(i ==9)
{
Object bFile = reader.readObject();
changing22.setText(bFile.toString());
}
if(i ==10)
{
Object bFile = reader.readObject();
changing11.setText(bFile.toString());
}
if(i ==11)
{
Object bFile = reader.readObject();
changing23.setText(bFile.toString());
}
if(i ==12)
{
Object bFile = reader.readObject();
changing35.setText(bFile.toString());
}
}
reader.close();
}
catch (IOException r)
{
r.printStackTrace();
}
catch (ClassNotFoundException q)
{
JOptionPane.showMessageDialog(null,"File Not Found","Error",JOptionPane.ERROR_MESSAGE);
}
` JFrame中的所有内容都只是JLabel。 如何使用JLabel使句子完全显示在框架中?是否需要在右侧重叠JLabel以显示完整的句子?如果是这样,怎么样?