public abstract class Application extends Object
import javax.swing.JLabel;
import javax.swing.JPanel;
import com.fathzer.soft.swing.framework.Application;
public class HelloWorld extends Application {
protected JPanel buildMainPanel() {
JPanel panel = new JPanel();
panel.add(new JLabel ("The simplest panel"));
return panel;
}
public static void main (String[] args) {
new HelloWorld().launch();
}
}
Modifier and Type | Field and Description |
---|---|
static LocalizationData |
LOCALIZATION |
Constructor and Description |
---|
Application() |
Modifier and Type | Method and Description |
---|---|
protected abstract Container |
buildMainPanel()
Creates the main panel.
|
protected JMenuBar |
buildMenuBar()
Builds the application menu bar.
|
protected String |
getDefaultLookAndFeelName()
Gets the default look and feel name.
|
protected JFrame |
getJFrame()
Gets the main application frame.
|
String |
getName()
Gets the application name.
|
static String |
getString(String key)
Gets a message localized in the default locale.
|
static String |
getString(String key,
Locale locale)
Gets a localized message.
|
void |
launch()
Launches the application.
|
protected void |
onClose(WindowEvent event)
This method is called when the application frame is closed.
|
protected boolean |
onStart()
This method is called one time, at startup, before the frame is made visible, on the eventDispatchThread.
|
protected void |
onVisible()
This method is called one time, at startup, after the frame is made visible, on the eventDispatchThread.
|
protected void |
processException(Throwable e)
Process an exception.
|
protected void |
quit()
Asks the application to quit.
|
protected void |
restoreState()
Restores the application state.
|
protected void |
saveState()
Saves the application state.
|
public static LocalizationData LOCALIZATION
public static String getString(String key)
key
- The message key.getString(String, Locale)
public static String getString(String key, Locale locale)
key
- The message key.locale
- The desired locale.LocalizationData
public final void launch()
protected void processException(Throwable e)
e
- The exceptionpublic String getName()
protected String getDefaultLookAndFeelName()
setLookAndFeel()
protected void saveState()
protected void restoreState()
protected abstract Container buildMainPanel()
protected JMenuBar buildMenuBar()
quit()
protected JFrame getJFrame()
protected void quit()
protected boolean onStart()
protected void onVisible()
protected void onClose(WindowEvent event)
event
- the Window event receivedsaveState()
Copyright © 2022. All rights reserved.