jdialog

JDialog doesn't size correctly with wrapped JTextArea

别说谁变了你拦得住时间么 提交于 2021-02-11 16:51:29
问题 While making a program, I noticed a bug with the JOptionPane.showMessageDialog() call. I use a button to create a JTextArea that wraps and then display a dialog containing this text area. If the text area is too large, however, the dialog does not size itself correctly to the height of the JTextArea. The Dialog cuts off the OK button in this example. I replicated the bug in the following code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class DialogBug { public

Why the JProgressBar doesn't respect the setSize()?

心不动则不痛 提交于 2021-02-08 11:52:12
问题 I'm having an issue with the JProgressBar, when it is printed in the GridBagLayout it is too little and the setSize method doesn't have effect, just to test I wrote 100 and 20 but the size remains something about 10x10 and I don't understand why, where is wrong? Thank you! import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event

Why the JProgressBar doesn't respect the setSize()?

*爱你&永不变心* 提交于 2021-02-08 11:52:07
问题 I'm having an issue with the JProgressBar, when it is printed in the GridBagLayout it is too little and the setSize method doesn't have effect, just to test I wrote 100 and 20 but the size remains something about 10x10 and I don't understand why, where is wrong? Thank you! import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event

Return a double value from JDialog to JFrame?

半世苍凉 提交于 2021-01-27 18:39:34
问题 I'm making a bank project and came into a problem. I have a Depositwindow class that extends to a JDialog and an Accountwindow class that extends to a JFrame . My problem is how to update my Accountwindow balance by adding the previous balance and the deposit amount in the Depositwindow class and display it in the Accountwindow balance? Here is my Accountwindow : import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.BorderLayout; import java.awt.event

201871010104-陈园园 《面向对象程序设计(java)》第十五周学习总结

只愿长相守 提交于 2020-11-14 07:34:30
201871010104-陈园园 《面向对象程序设计(java)》第十五周学习总结 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业要求在哪里 https://www.cnblogs.com/lily-2018/p/11441372.html 作业学习目标 (1) 掌握菜单组件用途及常用API; (2) 掌握对话框组件用途及常用API; (3) 学习设计简单应用程序的GUI。 第一部分:总结理论知识 菜单 创建菜单是一#非常容易的事情。首先要创建一个菜单栏: JMenuBar menuBar = newJMenuBar(); 菜单栏是一个可以添加到任何位置的组件。通常放置 图 12-19 带有子菜单的菜单在框架的顶部。可以调用setJMenuBar方法将菜单栏添加到框架上: frame.setJMenuBar(menuBar); 需要为每个菜单建立一个菜单对象: JMenu editMenu = new JMenu( "Edit"); 然后将顶层菜单添加到菜单栏中: menuBar.add(editMenu); 向菜单对象中添加菜单项、分隔符和子菜单: JMenuItem pasteltem = new JMenuItem( "Paste"); editMenu.add(pasteltem); editMenu