JLabel not showing up at all?

So this is my 3rd post for this project, hopefully the last. So when my program does on the math in the other classes, it needs to come out to a JLabel. the problem is, it doesn't show up. Maby one of you could help me? Sorry the code will be f'ed up when I post it, I cant fix it. import java.awt.Color; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class AFA { public void answer() { System.out.println("1"); int area = (int) (AF.length * AF.width); String an = String.valueOf(area); JFrame answer = new JFrame(); answer.setBackground(Color.yellow); JPanel pan2 = new JPanel(); JLabel a = new JLabel("The answer is " + an + "We got this by multiplying the Lenght by the width"); pan2.add(a); System.out.println("1"); answer.setVisible(true); } }
Oh for pity's sake, post an SSCCE like I posted as an answer to your last question. I was going to run the code to see if this is a duplicate of the last question, but could not be bothered turning your code into an SSCCE again!

以上就是JLabel not showing up at all?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准