本文整理汇总了Java中org.jdesktop.application.Application类的典型用法代码示例。如果您正苦于以下问题:Java Application类的具体用法?Java Application怎么用?Java Application使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Application类属于org.jdesktop.application包,在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeTextToLocale
import org.jdesktop.application.Application; //导入依赖的package包/类
private void changeTextToLocale() {
final org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application
.getInstance(ru.apertum.qsystem.QSystem.class).getContext()
.getResourceMap(FWelcome.class);
setTitle(resourceMap.getString("Form.title")); // NOI18N
labelCaption.setText(resourceMap.getString("labelCaption.text")); // NOI18N
buttonAdvance.setText("<html><p align=center>" + resourceMap
.getString(advanceRegim ? "lable.reg_calcel" : "lable.adv_reg")); // NOI18N
buttonStandAdvance.setText(resourceMap.getString("buttonStandAdvance.text")); // NOI18N
buttonToBegin.setText(resourceMap.getString("buttonToBegin.text")); // NOI18N
buttonBack.setText(resourceMap.getString("buttonBack.text")); // NOI18N
labelLock.setText(resourceMap.getString("labelLock.text")); // NOI18N
buttonInfo.setText(
"".equals(WelcomeParams.getInstance().infoHtml) ? resourceMap
.getString("buttonInfo.text")
: WelcomeParams.getInstance().infoHtml); // NOI18N
buttonResponse.setText("".equals(WelcomeParams.getInstance().responseHtml) ? resourceMap
.getString("buttonResponse.text") : WelcomeParams.getInstance().responseHtml); // NOI18N
buttonBackPage.setText(resourceMap.getString("buttonBackPage.text")); // NOI18N
buttonForwardPage.setText(resourceMap.getString("buttonForwardPage.text")); // NOI18N
labelBackPage.setText(resourceMap.getString("labelBackPage.text")); // NOI18N
labelForwardPage.setText(resourceMap.getString("labelForwardPage.text")); // NOI18N
}
示例2: changeTextToLocale
import org.jdesktop.application.Application; //导入依赖的package包/类
private void changeTextToLocale(int count) {
final org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application
.getInstance(ru.apertum.qsystem.QSystem.class).getContext()
.getResourceMap(FConfirmationStart.class);
buttonOk.setText(resourceMap.getString("buttonOk.text")); // NOI18N
buttonCancel.setText(resourceMap.getString("buttonCancel.text")); // NOI18N
labelInfo.setIcon(
new File(WelcomeParams.getInstance().confirmationStartImg).exists() ? new ImageIcon(
WelcomeParams.getInstance().confirmationStartImg) : new javax.swing.ImageIcon(
getClass().getResource("/ru/apertum/qsystem/client/forms/resources/vopros.png")));
labelInfo.setText(WelcomeParams.getInstance().patternConfirmationStart
.replace("dialog.text_before", getLocaleMessage("dialod.text_before")).
replace("dialog.count", "" + count).
replace("dialog.text_people", getLocaleMessage("dialod.text_before_people")).
replace("[[endRus]]",
(((!Locale.getDefault().getLanguage().startsWith("en")) && ((count % 10) >= 2)
&& (
(count % 10) <= 4)) ? "a" : ""))); // NOI18N
}
示例3: canExit
import org.jdesktop.application.Application; //导入依赖的package包/类
@Override
public boolean canExit (EventObject eo)
{
// Check whether the repository has been saved (or user has declined)
if (isModified()) {
SingleFrameApplication appli = (SingleFrameApplication) Application.getInstance();
int answer = JOptionPane.showConfirmDialog(
appli.getMainFrame(),
"Save " + SampleRepository.this + "?");
if (answer == JOptionPane.YES_OPTION) {
storeRepository();
return true; // Here user has saved the repository
}
// True: user specifically chooses NOT to save the script
// False: user says Oops!, cancelling the current close request
return answer == JOptionPane.NO_OPTION;
}
return true;
}
示例4: main
import org.jdesktop.application.Application; //导入依赖的package包/类
/**
* Just to allow stand-alone running of this class
*
* @param args not used
*/
public static void main (String... args)
{
standAlone = true;
// Load repository, with sheet images
SampleRepository repo = SampleRepository.getGlobalInstance();
repo.loadAllImages();
// Set UI Look and Feel
UILookAndFeel.setUI(null);
Locale.setDefault(Locale.ENGLISH);
// Off we go...
Application.launch(SampleBrowser.class, args);
}
示例5: windowClosing
import org.jdesktop.application.Application; //导入依赖的package包/类
@Override
public void windowClosing (WindowEvent e)
{
// Check for modified repo
Application.ExitListener exitListener = repository.getExitListener();
boolean ok = exitListener.canExit(e);
if (ok) {
OmrGui.getApplication().removeExitListener(exitListener);
if (repository.isGlobal()) {
INSTANCE = null;
}
repository.close();
frame.dispose(); // Do close
}
}
示例6: showFrame
import org.jdesktop.application.Application; //导入依赖的package包/类
/**
* Display the UI frame.
*/
public static void showFrame ()
{
if (frame == null) {
frame = new JFrame();
frame.setName("shapeColorChooserFrame");
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.add(new ShapeColorChooser().component);
// Resources injection
ResourceMap resource = Application.getInstance().getContext().getResourceMap(
ShapeColorChooser.class);
resource.injectComponents(frame);
}
OmrGui.getApplication().show(frame);
}
示例7: main
import org.jdesktop.application.Application; //导入依赖的package包/类
public static void main(String args[]) {
if (Util.MAC_OS_X && !Util.INSIDE_APP_BUNDLE) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", getProperty("id"));
}
String lang = WWPreferences.getPreferences().getLanguage();
if (lang.length() > 0) {
String[] langParts = lang.split("_");
switch (langParts.length) {
case 1:
Locale.setDefault(new Locale(langParts[0]));
break;
case 2:
Locale.setDefault(new Locale(langParts[0], langParts[1]));
break;
}
}
Application.launch(WiimoteWhiteboard.class, args);
}
示例8: CameraMonitor
import org.jdesktop.application.Application; //导入依赖的package包/类
public CameraMonitor(WiimoteDataHandler dh) {
super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), Util.getResourceMap(CameraMonitor.class).getString("monitor.Action.text"));
getRootPane().putClientProperty("Window.style", "small");
setLayout(new MigLayout());
dh.addWiimoteDataListener(this);
canvas = new JPanel(null, true);
canvas.setOpaque(true);
canvas.setBorder(BorderFactory.createLineBorder(SystemColor.inactiveCaptionBorder));
add(canvas, "w 50sp, h 50sp, grow, push");
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
setVisible(false);
}
}
});
pack();
setLocationRelativeTo(null);
new Timer(true).schedule(new UpdateTask(), 0, REPAINT_FREQ);
}
示例9: main
import org.jdesktop.application.Application; //导入依赖的package包/类
/**
* main method allows us to run as a standalone demo.
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
StyledTextActions.install(Application.getInstance().getContext());
JFrame frame = new JFrame(XEditorPaneDemo.class.getAnnotation(DemoProperties.class).value());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new XEditorPaneDemo());
frame.setPreferredSize(new Dimension(800, 600));
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
示例10: Consensus
import org.jdesktop.application.Application; //导入依赖的package包/类
/** Creates new form Consensus */
public Consensus(XProtTestView mainFrame, TreeFacade facade,
Model[] models, Alignment alignment) {
initComponents();
this.mainFrame = mainFrame;
this.facade = facade;
this.models = new SingleModelCollection(models, alignment);
this.displayWriter = new PrintWriter(new TextAreaWriter(displayArea));
this.logHandler = getDefaultLogger().addHandler(displayWriter,
Level.OFF);
resourceMap = Application
.getInstance(es.uvigo.darwin.xprottest.XProtTestApp.class)
.getContext().getResourceMap(Consensus.class);
Font f = new Font(Font.MONOSPACED, Font.PLAIN, 12);
displayArea.setFont(f);
}
示例11: displayZettelContent
import org.jdesktop.application.Application; //导入依赖的package包/类
/**
*
* @param nr
* @return
*/
private void displayZettelContent(int nr) {
// retrieve the string array of the first entry
String disp = data.getEntryAsHtml(nr, (settings.getHighlightSegments()) ? retrieveSelectedKeywordsFromList() : null, Constants.FRAME_MAIN);
// in case parsing was ok, display the entry
if (Tools.isValidHTML(disp, nr)) {
// set entry information in the main textfield
jEditorPaneEntry.setText(disp);
} // else show error message box to user and tell him what to do
else {
StringBuilder cleanedContent = new StringBuilder("");
cleanedContent.append("<body><div style=\"margin:5px;padding:5px;background-color:#dddddd;color:#800000;\">");
URL imgURL = org.jdesktop.application.Application.getInstance(de.danielluedecke.zettelkasten.ZettelkastenApp.class).getClass().getResource("/de/danielluedecke/zettelkasten/resources/icons/error.png");
cleanedContent.append("<img border=\"0\" src=\"").append(imgURL).append("\"> ");
cleanedContent.append(getResourceMap().getString("incorrectNestedTagsText"));
cleanedContent.append("</div>").append(data.getCleanZettelContent(nr)).append("</body>");
// and display clean content instead
jEditorPaneEntry.setText(cleanedContent.toString());
}
// place caret, so content scrolls to top
jEditorPaneEntry.setCaretPosition(1);
// set entry number tzo textfield
jTextFieldEntryNumber.setText(String.valueOf(data.getCurrentZettelPos()));
}
示例12: succeeded
import org.jdesktop.application.Application; //导入依赖的package包/类
@Override
protected void succeeded(Object result) {
// Runs on the EDT. Update the GUI based on
// the result computed by doInBackground().
DefaultTableModel tm = (DefaultTableModel) jTableLinks.getModel();
// reset the table
tm.setRowCount(0);
// check whether we have any entries at all...
if (linkedfilteredlinkslist != null) {
// create iterator for linked list
Iterator<Object[]> i = linkedfilteredlinkslist.iterator();
// go through linked list and add all objects to the table model
try {
while (i.hasNext()) {
tm.addRow(i.next());
}
} catch (ConcurrentModificationException e) {
// reset the table when we have overlappings threads
tm.setRowCount(0);
}
}
// show amount of entries
statusMsgLabel.setText("(" + String.valueOf(jTableLinks.getRowCount()) + " " + org.jdesktop.application.Application.getInstance(de.danielluedecke.zettelkasten.ZettelkastenApp.class).getContext().getResourceMap(ZettelkastenView.class).getString("statusTextLinks") + ")");
}
示例13: makeAutoBackup
import org.jdesktop.application.Application; //导入依赖的package包/类
/**
* This method starts a background thread that creates an automatic backup
* of the current main data file. the file is saved to the same directory as
* the main data file, just changing the extenstion to ".zkb3".
* <br><br>
* This method is called when we have changes that are not save, e.g. after
* the methods {@link #newEntry() newEntry()} or
* {@link #editEntry() editEntry()}.
*/
private void makeAutoBackup() {
// if
// - task is already running, or
// - no backup necessary
// - or an save-operation is in progress...
// ...then do nothing.
if (isAutoBackupRunning() || !isBackupNecessary() || isSaving) {
return;
}
// check for autobackup
if (settings.getAutoBackup() && (settings.getFilePath() != null)) {
Task cabT = autoBackupTask();
// get the application's context...
ApplicationContext appC = Application.getInstance().getContext();
// ...to get the TaskMonitor and TaskService
TaskMonitor tM = appC.getTaskMonitor();
TaskService tS = appC.getTaskService();
// with these we can execute the task and bring it to the foreground
// i.e. making the animated progressbar and busy icon visible
tS.execute(cabT);
tM.setForegroundTask(cabT);
} else {
setAutoBackupRunning(false);
}
}
示例14: initialize
import org.jdesktop.application.Application; //导入依赖的package包/类
@Before
public void initialize() throws Exception {
settings = TestObjectFactory.ZKN3Settings.ZKN3_TRICKY_MARKDOWN;
daten = TestObjectFactory.getDaten(settings);
JDialog parent = null;
Application app = org.jdesktop.application.Application
.getInstance(de.danielluedecke.zettelkasten.ZettelkastenApp.class);
JLabel label = new JLabel();
TasksData td = null;
DesktopData dt = null;
File fp = null;
BibTex bto = null;
ArrayList<Object> ee = null;
int type = 0;
int part = 0;
DefaultMutableTreeNode n = null;
boolean bibtex = false;
boolean ihv = false;
boolean numberprefix = false;
boolean contenttable = false;
exportToTexTask = new ExportToTexTask(app, parent, label, td, daten,
dt, settings.settings, bto, fp, ee, type, part, n, bibtex, ihv,
numberprefix, contenttable, false);
}
示例15: showFrame
import org.jdesktop.application.Application; //导入依赖的package包/类
/**
* Display the UI frame.
*/
public static void showFrame ()
{
if (frame == null) {
frame = new JFrame();
frame.setName("shapeColorChooserFrame");
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.add(new ShapeColorChooser().component);
// Resources injection
ResourceMap resource = Application.getInstance()
.getContext()
.getResourceMap(
ShapeColorChooser.class);
resource.injectComponents(frame);
}
MainGui.getInstance()
.show(frame);
}