From JavaDoc :
public void validate()Checks this container and all its subcomponents. Checking a container means highlighting its subcomponents.
public void validate()
Checks this container and all its subcomponents. Checking a container means highlighting its subcomponents.
Here is what I want to do. With the lightest component possible. But when I do this with JComponent, the call validate()does not make the component "valid".
JComponent
validate()
JComponent c = new JComponent() {}; System.out.println(c.isValid()); // false c.validate(); System.out.println(c.isValid()); // false
Why can't I make it JComponentvalid?
The docs for isValid()say:
isValid()
A component is valid if it is correctly installed and placed in its parent container, and all its children are also valid.
, (JFrame, JInternalFrame JApplet). , , JComponent , .
JFrame
JInternalFrame
JApplet
Javadoc java.awt.Component.isValid() :
java.awt.Component.isValid()
, , .
To add answers to the above, do not forget to override the method getPreferedSize()to return the size of your component. Otherwise, the layout manager will not position yours JComponent, therefore, it will not be displayed.
getPreferedSize()
Source: https://habr.com/ru/post/1746983/More articles:silverlight: change uri to my dataservice after deployment - silverlightHow can I "pack" () "a printable Java Swing component? - javaMultiple Service Address Configurations in Silverlight Silverlight - .nettemplate for transferring a search model to dao - javalink structure showing plain text / code - c #Database Design (MySql) :: should I put html data in a text field inside a database table or is it more efficient to save it inside a text.txt file? - mysqlI cannot use database in SQL Azure - sql-serverLoading background in PHP - phplog4net и .net Framework 4.0 - .net-4.0Show right click options in the selected list Record only - Winforms C # .NET - c #All Articles