use of com.codename1.designer.AddResourceDialog in project CodenameOne by codenameone.
the class AddThemeEntry method addNewImageActionPerformed.
// GEN-LAST:event_imagesComboActionPerformed
private void addNewImageActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_addNewImageActionPerformed
AddResourceDialog addResource = new AddResourceDialog(resources, AddResourceDialog.IMAGE, false);
if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(this, addResource, "Select Name", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE)) {
addResource.addResource(resources, null);
initImagesCombo();
}
}
use of com.codename1.designer.AddResourceDialog in project CodenameOne by codenameone.
the class ResourceEditorView method addNewFontWizard.
/**
* Invoked by the "..." button in the add theme entry dialog, allows us to add
* a font on the fly while working on a theme
*/
public void addNewFontWizard() {
AddResourceDialog addResource = new AddResourceDialog(loadedResources, AddResourceDialog.FONT);
if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(mainPanel, addResource, "Add Font", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE)) {
if (addResource.checkName(loadedResources)) {
JOptionPane.showMessageDialog(mainPanel, "A resource with that name already exists", "Add Font", JOptionPane.ERROR_MESSAGE);
addNewFontWizard();
return;
}
// show the image editing dialog...
FontEditor font = new FontEditor(loadedResources, new EditorFont(com.codename1.ui.Font.createSystemFont(com.codename1.ui.Font.FACE_SYSTEM, com.codename1.ui.Font.STYLE_PLAIN, com.codename1.ui.Font.SIZE_MEDIUM), null, "Arial-plain-12", true, RenderingHints.VALUE_TEXT_ANTIALIAS_ON, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:!/\\*()[]{}|#$%^&<>?'\"+- "), addResource.getResourceName());
font.setFactoryCreation(true);
if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(mainPanel, font, "Add Font", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE)) {
loadedResources.setFont(addResource.getResourceName(), font.createFont());
}
}
}
Aggregations