Example usage for javax.swing JDialog setSize

List of usage examples for javax.swing JDialog setSize

Introduction

In this page you can find the example usage for javax.swing JDialog setSize.

Prototype

public void setSize(int width, int height) 

Source Link

Document

The width and height values are automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .

Usage

From source file:org.apache.uima.tools.docanalyzer.DBAnnotationViewerDialog.java

public void launchThatViewer(String xmi_id, TypeSystem typeSystem, final String[] aTypesToDisplay,
        boolean javaViewerRBisSelected, boolean javaViewerUCRBisSelected, boolean xmlRBisSelected,
        File styleMapFile, File viewerDirectory) {

    try {//from  w  w  w .jav a 2  s . co m

        InputStream xmiDocument = this.xmiDAO.getXMI(xmi_id);

        // create a new CAS
        CAS cas = CasCreationUtils.createCas(Collections.EMPTY_LIST, typeSystem,
                UIMAFramework.getDefaultPerformanceTuningProperties());

        if (this.med1.isUmcompress()) {

            //Descomprime el XMI
            System.out.println("con compresin");

            //Create the decompressor and give it the data to compress
            Inflater decompressor = new Inflater();
            byte[] documentDataByteArray = IOUtils.toByteArray(xmiDocument);

            decompressor.setInput(documentDataByteArray);

            //Create an expandable byte array to hold the decompressed data
            ByteArrayOutputStream bos = new ByteArrayOutputStream(documentDataByteArray.length);

            //Decompress the data
            byte[] buf = new byte[1024];

            while (!decompressor.finished()) {

                int count = decompressor.inflate(buf);
                bos.write(buf, 0, count);
            }

            bos.close();

            //Get the decompressed data
            byte[] decompressedData = bos.toByteArray();

            XmiCasDeserializer.deserialize(new ByteArrayInputStream(decompressedData), cas, true);
        } else {

            System.out.println("sin compresin");
            XmlCasDeserializer.deserialize(xmiDocument, cas, true);
        }

        //get the specified view
        cas = cas.getView(this.defaultCasViewName);

        //launch appropriate viewer
        if (javaViewerRBisSelected || javaViewerUCRBisSelected) { // JMP

            // record preference for next time
            med1.setViewType(javaViewerRBisSelected ? "Java Viewer" : "JV User Colors");

            //create tree viewer component
            CasAnnotationViewer viewer = new CasAnnotationViewer();
            viewer.setDisplayedTypes(aTypesToDisplay);

            if (javaViewerUCRBisSelected)
                getColorsForTypesFromFile(viewer, styleMapFile);
            else
                viewer.setHiddenTypes(new String[] { "uima.cpm.FileLocation" });

            // launch viewer in a new dialog
            viewer.setCAS(cas);
            JDialog dialog = new JDialog(DBAnnotationViewerDialog.this,
                    "Annotation Results for " + xmi_id + " in " + inputDirPath); // JMP
            dialog.getContentPane().add(viewer);
            dialog.setSize(850, 630);
            dialog.pack();
            dialog.show();
        } else {

            CAS defaultView = cas.getView(CAS.NAME_DEFAULT_SOFA);

            if (defaultView.getDocumentText() == null) {
                displayError(
                        "The HTML and XML Viewers can only view the default text document, which was not found in this CAS.");
                return;
            }

            // generate inline XML
            File inlineXmlFile = new File(viewerDirectory, "inline.xml");
            String xmlAnnotations = new CasToInlineXml().generateXML(defaultView);
            FileOutputStream outStream = new FileOutputStream(inlineXmlFile);
            outStream.write(xmlAnnotations.getBytes("UTF-8"));
            outStream.close();

            if (xmlRBisSelected) // JMP passed in
            {
                // record preference for next time
                med1.setViewType("XML");

                BrowserUtil.openUrlInDefaultBrowser(inlineXmlFile.getAbsolutePath());
            } else
            // HTML view
            {
                med1.setViewType("HTML");
                // generate HTML view
                // first process style map if not done already
                if (!processedStyleMap) {
                    if (!styleMapFile.exists()) {
                        annotationViewGenerator.autoGenerateStyleMapFile(
                                promptForAE().getAnalysisEngineMetaData(), styleMapFile);
                    }
                    annotationViewGenerator.processStyleMap(styleMapFile);
                    processedStyleMap = true;
                }
                annotationViewGenerator.processDocument(inlineXmlFile);
                File genFile = new File(viewerDirectory, "index.html");
                // open in browser
                BrowserUtil.openUrlInDefaultBrowser(genFile.getAbsolutePath());
            }
        }

        // end LTV here

    } catch (Exception ex) {

        displayError(ex);
    }
}

From source file:org.barcelonamedia.uima.tools.docanalyzer.DBAnnotationViewerDialog.java

public void launchThatViewer(String xmi_id, TypeSystem typeSystem, final String[] aTypesToDisplay,
        boolean javaViewerRBisSelected, boolean javaViewerUCRBisSelected, boolean xmlRBisSelected,
        File styleMapFile, File viewerDirectory) {

    try {//from   w  w w .j  av  a 2 s  .c  om

        InputStream xmiDocument = this.xmiDAO.getXMI(xmi_id);

        // create a new CAS
        CAS cas = CasCreationUtils.createCas(Collections.EMPTY_LIST, typeSystem,
                UIMAFramework.getDefaultPerformanceTuningProperties());

        if (this.med1.isUmcompress()) {

            //Descomprime el XMI

            //Create the decompressor and give it the data to compress
            Inflater decompressor = new Inflater();
            byte[] documentDataByteArray = IOUtils.toByteArray(xmiDocument);

            decompressor.setInput(documentDataByteArray);

            //Create an expandable byte array to hold the decompressed data
            ByteArrayOutputStream bos = new ByteArrayOutputStream(documentDataByteArray.length);

            //Decompress the data
            byte[] buf = new byte[1024];

            while (!decompressor.finished()) {

                int count = decompressor.inflate(buf);
                bos.write(buf, 0, count);
            }

            bos.close();

            //Get the decompressed data
            byte[] decompressedData = bos.toByteArray();

            XmiCasDeserializer.deserialize(new ByteArrayInputStream(decompressedData), cas, true);
        } else {

            XmlCasDeserializer.deserialize(xmiDocument, cas, true);
        }

        //get the specified view
        cas = cas.getView(this.defaultCasViewName);

        //launch appropriate viewer
        if (javaViewerRBisSelected || javaViewerUCRBisSelected) { // JMP

            // record preference for next time
            med1.setViewType(javaViewerRBisSelected ? "Java Viewer" : "JV User Colors");

            //create tree viewer component
            CasAnnotationViewer viewer = new CasAnnotationViewer();
            viewer.setDisplayedTypes(aTypesToDisplay);

            if (javaViewerUCRBisSelected)
                getColorsForTypesFromFile(viewer, styleMapFile);
            else
                viewer.setHiddenTypes(new String[] { "uima.cpm.FileLocation" });

            // launch viewer in a new dialog
            viewer.setCAS(cas);
            JDialog dialog = new JDialog(DBAnnotationViewerDialog.this,
                    "Annotation Results for " + xmi_id + " in " + inputDirPath); // JMP
            dialog.getContentPane().add(viewer);
            dialog.setSize(850, 630);
            dialog.pack();
            dialog.show();
        } else {

            CAS defaultView = cas.getView(CAS.NAME_DEFAULT_SOFA);

            if (defaultView.getDocumentText() == null) {
                displayError(
                        "The HTML and XML Viewers can only view the default text document, which was not found in this CAS.");
                return;
            }

            // generate inline XML
            File inlineXmlFile = new File(viewerDirectory, "inline.xml");
            String xmlAnnotations = new CasToInlineXml().generateXML(defaultView);
            FileOutputStream outStream = new FileOutputStream(inlineXmlFile);
            outStream.write(xmlAnnotations.getBytes("UTF-8"));
            outStream.close();

            if (xmlRBisSelected) // JMP passed in
            {
                // record preference for next time
                med1.setViewType("XML");

                BrowserUtil.openUrlInDefaultBrowser(inlineXmlFile.getAbsolutePath());
            } else
            // HTML view
            {
                med1.setViewType("HTML");
                // generate HTML view
                // first process style map if not done already
                if (!processedStyleMap) {
                    if (!styleMapFile.exists()) {
                        annotationViewGenerator.autoGenerateStyleMapFile(
                                promptForAE().getAnalysisEngineMetaData(), styleMapFile);
                    }
                    annotationViewGenerator.processStyleMap(styleMapFile);
                    processedStyleMap = true;
                }
                annotationViewGenerator.processDocument(inlineXmlFile);
                File genFile = new File(viewerDirectory, "index.html");
                // open in browser
                BrowserUtil.openUrlInDefaultBrowser(genFile.getAbsolutePath());
            }
        }

        // end LTV here

    } catch (Exception ex) {

        displayError(ex);
    }
}

From source file:org.geworkbench.components.lincs.LincsInterface.java

private void viewLicense_actionPerformed(String FileName) {

    getLicenseFromFile(FileName);//from   w w  w . jav a 2  s  .co  m
    JDialog licenseDialog = new JDialog();
    final JEditorPane jEditorPane = new JEditorPane("text/html", "");
    jEditorPane.getDocument().putProperty("IgnoreCharsetDirective", Boolean.TRUE);
    jEditorPane.setText(licenseContent);
    if (jEditorPane.getCaretPosition() > 1) {
        jEditorPane.setCaretPosition(1);
    }
    JScrollPane scrollPane = new JScrollPane(jEditorPane);
    licenseDialog.setTitle("Lincs Interface License");
    licenseDialog.setContentPane(scrollPane);
    licenseDialog.setSize(400, 300);
    licenseDialog.setLocationRelativeTo(this);
    licenseDialog.setVisible(true);
}

From source file:org.geworkbench.engine.ccm.ComponentConfigurationManagerWindow.java

/**
 * Display a dialog box with a components license in it.
 * //  ww  w. j  ava  2 s.c o m
 * @param ActionEvent
 * @return void
 */
private void viewLicense_actionPerformed(ActionEvent e) {

    int[] selectedRow = table.getSelectedRows();

    String license = "Select a component in order to view its license.";
    String componentName = null;
    if (selectedRow != null && selectedRow.length > 0 && selectedRow[0] >= 0) {

        int modelRow = table.convertRowIndexToModel(selectedRow[0]);
        license = (String) ccmTableModel.getModelValueAt(modelRow, CCMTableModel.LICENSE_INDEX);
        componentName = (String) ccmTableModel.getModelValueAt(modelRow, CCMTableModel.NAME_INDEX);
    }

    JDialog licenseDialog = new JDialog();
    final JEditorPane jEditorPane = new JEditorPane("text/html", "");
    jEditorPane.getDocument().putProperty("IgnoreCharsetDirective", Boolean.TRUE);
    jEditorPane.setText(license);
    if (jEditorPane.getCaretPosition() > 1) {
        jEditorPane.setCaretPosition(1);
    }
    JScrollPane scrollPane = new JScrollPane(jEditorPane);
    licenseDialog.setTitle(componentName + " License");
    licenseDialog.setContentPane(scrollPane);
    licenseDialog.setSize(400, 300);
    licenseDialog.setLocationRelativeTo(frame);
    licenseDialog.setVisible(true);
}

From source file:org.geworkbench.engine.ccm.ComponentConfigurationManagerWindow2.java

/**
 * Display a dialog box with a components license in it.
 * //from w w  w  . j  ava 2 s . c  om
 * @param ActionEvent
 * @return void
 */
private void viewLicense_actionPerformed(ActionEvent e) {

    int[] selectedRow = table.getSelectedRows();

    String license = "Select a component in order to view its license.";
    String componentName = null;
    if (selectedRow != null && selectedRow.length > 0 && selectedRow[0] >= 0) {

        int modelRow = table.convertRowIndexToModel(selectedRow[0]);
        license = (String) ccmTableModel.getModelValueAt(modelRow, CCMTableModel2.LICENSE_INDEX);
        componentName = (String) ccmTableModel.getModelValueAt(modelRow, CCMTableModel2.NAME_INDEX);
    }

    JDialog licenseDialog = new JDialog();
    final JEditorPane jEditorPane = new JEditorPane("text/html", "");
    jEditorPane.getDocument().putProperty("IgnoreCharsetDirective", Boolean.TRUE);
    jEditorPane.setText(license);
    if (jEditorPane.getCaretPosition() > 1) {
        jEditorPane.setCaretPosition(1);
    }
    JScrollPane scrollPane = new JScrollPane(jEditorPane);
    licenseDialog.setTitle(componentName + " License");
    licenseDialog.setContentPane(scrollPane);
    licenseDialog.setSize(400, 300);
    licenseDialog.setLocationRelativeTo(frame);
    licenseDialog.setVisible(true);
}

From source file:org.javaswift.cloudie.CloudiePanel.java

public void onLogin() {
    final JDialog loginDialog = new JDialog(owner, "Login");
    final LoginPanel loginPanel = new LoginPanel(new LoginCallback() {
        @Override//from  ww w .  j  av  a 2s. c  o  m
        public void doLogin(AccountConfig accountConfig) {
            CloudieCallback cb = GuiTreadingUtils.guiThreadSafe(CloudieCallback.class,
                    new CloudieCallbackWrapper(callback) {
                        @Override
                        public void onLoginSuccess() {
                            loginDialog.setVisible(false);
                            super.onLoginSuccess();
                        }

                        @Override
                        public void onError(CommandException ex) {
                            JOptionPane.showMessageDialog(loginDialog, "Login Failed\n" + ex.toString(),
                                    "Error", JOptionPane.ERROR_MESSAGE);
                        }
                    });
            ops.login(accountConfig, cb);
        }
    }, credentialsStore);
    try {
        loginPanel.setOwner(loginDialog);
        loginDialog.getContentPane().add(loginPanel);
        loginDialog.setModal(true);
        loginDialog.setSize(480, 340);
        loginDialog.setResizable(false);
        loginDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
        center(loginDialog);
        loginDialog.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                loginPanel.onCancel();
            }

            @Override
            public void windowOpened(WindowEvent e) {
                loginPanel.onShow();
            }
        });
        loginDialog.setVisible(true);
    } finally {
        loginDialog.dispose();
    }
}

From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java

/**
  * Creates a modal JDialog containing the specified JComponent
  * for the specified parent.//  w w  w. j a  va  2  s.  com
  * The newly created dialog is then centered on the screen and made visible.
 *
  * @param parent The parent component.
  * @param title  The title of the dialog.
  * @param c      The component to display.
  * @see #centerAndShow(Component)
 */
public static void makeForDialog(Component parent, String title, JComponent c) {
    if (c == null)
        return;
    JDialog dialog = null;
    if (parent instanceof Frame)
        dialog = new JDialog((Frame) parent);
    else if (parent instanceof Dialog)
        dialog = new JDialog((Dialog) parent);
    else if (dialog == null)
        dialog = new JDialog(); //no parent
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.setModal(true);
    dialog.setTitle(title);
    dialog.setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
    Container container = dialog.getContentPane();
    container.setLayout(new BorderLayout(0, 0));
    container.add(c, BorderLayout.CENTER);
    centerAndShow(dialog);
}

From source file:pl.otros.vfs.browser.demo.TestBrowser.java

public static void main(final String[] args)
        throws InterruptedException, InvocationTargetException, SecurityException, IOException {
    if (args.length > 1)
        throw new IllegalArgumentException(
                "SYNTAX:  java... " + TestBrowser.class.getName() + " [initialPath]");

    SwingUtilities.invokeAndWait(new Runnable() {

        @Override//w  w  w .j a  v a  2s.  c o m
        public void run() {
            tryLoadSubstanceLookAndFeel();
            final JFrame f = new JFrame("OtrosVfsBrowser demo");
            Container contentPane = f.getContentPane();
            contentPane.setLayout(new BorderLayout());
            DataConfiguration dc = null;
            final PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration();
            File favoritesFile = new File("favorites.properties");
            propertiesConfiguration.setFile(favoritesFile);
            if (favoritesFile.exists()) {
                try {
                    propertiesConfiguration.load();
                } catch (ConfigurationException e) {
                    e.printStackTrace();
                }
            }
            dc = new DataConfiguration(propertiesConfiguration);
            propertiesConfiguration.setAutoSave(true);
            final VfsBrowser comp = new VfsBrowser(dc, (args.length > 0) ? args[0] : null);
            comp.setSelectionMode(SelectionMode.FILES_ONLY);
            comp.setMultiSelectionEnabled(true);
            comp.setApproveAction(new AbstractAction(Messages.getMessage("demo.showContentButton")) {
                @Override
                public void actionPerformed(ActionEvent e) {
                    FileObject[] selectedFiles = comp.getSelectedFiles();
                    System.out.println("Selected files count=" + selectedFiles.length);
                    for (FileObject selectedFile : selectedFiles) {
                        try {
                            FileSize fileSize = new FileSize(selectedFile.getContent().getSize());
                            System.out.println(selectedFile.getName().getURI() + ": " + fileSize.toString());
                            byte[] bytes = readBytes(selectedFile.getContent().getInputStream(), 150 * 1024l);
                            JScrollPane sp = new JScrollPane(new JTextArea(new String(bytes)));
                            JDialog d = new JDialog(f);
                            d.setTitle("Content of file: " + selectedFile.getName().getFriendlyURI());
                            d.getContentPane().add(sp);
                            d.setSize(600, 400);
                            d.setVisible(true);
                        } catch (Exception e1) {
                            LOGGER.error("Failed to read file", e1);
                            JOptionPane.showMessageDialog(f,
                                    (e1.getMessage() == null) ? e1.toString() : e1.getMessage(), "Error",
                                    JOptionPane.ERROR_MESSAGE);
                        }
                    }
                }
            });

            comp.setCancelAction(new AbstractAction(Messages.getMessage("general.cancelButtonText")) {
                @Override
                public void actionPerformed(ActionEvent e) {
                    f.dispose();
                    try {
                        propertiesConfiguration.save();
                    } catch (ConfigurationException e1) {
                        e1.printStackTrace();
                    }
                    System.exit(0);
                }
            });
            contentPane.add(comp);

            f.pack();
            f.setVisible(true);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        }
    });
}

From source file:utybo.branchingstorytree.swing.editor.StoryEditor.java

public StoryEditor(BranchingStory baseStory) throws BSTException {
    setLayout(new MigLayout("hidemode 3", "[grow]", "[][grow]"));

    JToolBar toolBar = new JToolBar();
    toolBar.setBorder(null);//from   www  .j  a v a  2  s.co  m
    toolBar.setFloatable(false);
    add(toolBar, "cell 0 0,growx");

    JButton btnSaveAs = new JButton(Lang.get("saveas"), new ImageIcon(Icons.getImage("Save As", 16)));
    btnSaveAs.addActionListener(e -> {
        saveAs();
    });
    toolBar.add(btnSaveAs);

    JButton btnSave = new JButton(Lang.get("save"), new ImageIcon(Icons.getImage("Save", 16)));
    btnSave.addActionListener(e -> {
        save();
    });
    toolBar.add(btnSave);

    JButton btnPlay = new JButton(Lang.get("play"), new ImageIcon(Icons.getImage("Circled Play", 16)));
    btnPlay.addActionListener(ev -> {
        try {
            String s = exportToString();
            File f = Files.createTempDirectory("openbst").toFile();
            File bstFile = new File(f, "expoted.bst");
            try (FileOutputStream fos = new FileOutputStream(bstFile);) {
                IOUtils.write(s, fos, StandardCharsets.UTF_8);
            }
            OpenBSTGUI.getInstance().openStory(bstFile);
        } catch (Exception e) {
            OpenBST.LOG.error("Export failed", e);
            Messagers.showException(OpenBSTGUI.getInstance(), Lang.get("editor.exportfail"), e);
        }
    });
    toolBar.add(btnPlay);

    JButton btnFilePreview = new JButton(Lang.get("editor.exportpreview"),
            new ImageIcon(Icons.getImage("PreviewText", 16)));
    btnFilePreview.addActionListener(e -> {
        try {
            String s = exportToString();
            JDialog dialog = new JDialog(OpenBSTGUI.getInstance(), Lang.get("editor.exportpreview"));
            JTextArea jta = new JTextArea(s);
            jta.setLineWrap(true);
            jta.setWrapStyleWord(true);
            dialog.add(new JScrollPane(jta));

            dialog.setModalityType(ModalityType.APPLICATION_MODAL);
            dialog.setSize((int) (Icons.getScale() * 350), (int) (Icons.getScale() * 300));
            dialog.setLocationRelativeTo(OpenBSTGUI.getInstance());
            dialog.setVisible(true);
        } catch (Exception x) {
            OpenBST.LOG.error("Failed to preview", x);
            Messagers.showException(OpenBSTGUI.getInstance(), Lang.get("editor.previewerror"), x);
        }
    });
    toolBar.add(btnFilePreview);

    Component horizontalGlue = Box.createHorizontalGlue();
    toolBar.add(horizontalGlue);

    JButton btnClose = new JButton(Lang.get("close"), new ImageIcon(Icons.getImage("Cancel", 16)));
    btnClose.addActionListener(e -> {
        askClose();
    });
    toolBar.add(btnClose);

    for (final Component component : toolBar.getComponents()) {
        if (component instanceof JButton) {
            ((JButton) component).setHideActionText(false);
            ((JButton) component).setToolTipText(((JButton) component).getText());
            ((JButton) component).setText("");
        }
    }

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setTabPlacement(JTabbedPane.LEFT);
    add(tabbedPane, "cell 0 1,grow");

    tabbedPane.addTab("Beta Warning", new StoryEditorWelcomeScreen());

    details = new StoryDetailsEditor(this);
    tabbedPane.addTab(Lang.get("editor.details"), details);

    nodesEditor = new StoryNodesEditor();
    tabbedPane.addTab(Lang.get("editor.nodes"), nodesEditor);

    this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("control S"),
            "doSave");
    this.getActionMap().put("doSave", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            save();
        }
    });

    importFrom(baseStory);
}

From source file:utybo.branchingstorytree.swing.OpenBSTGUI.java

private JMenu createShortMenu() {
    JMenu shortMenu = new JMenu();
    addDarkModeCallback(b -> {//  ww  w. ja v  a  2  s . co  m
        shortMenu.setBackground(b ? OPENBST_BLUE.darker().darker() : OPENBST_BLUE.brighter());
        shortMenu.setForeground(b ? Color.WHITE : OPENBST_BLUE);
    });
    shortMenu.setBackground(OPENBST_BLUE.brighter());
    shortMenu.setForeground(OPENBST_BLUE);
    shortMenu.setText(Lang.get("banner.title"));
    shortMenu.setIcon(new ImageIcon(Icons.getImage("Logo", 16)));
    JMenuItem label = new JMenuItem(Lang.get("menu.title"));
    label.setEnabled(false);
    shortMenu.add(label);
    shortMenu.addSeparator();
    shortMenu.add(
            new JMenuItem(new AbstractAction(Lang.get("menu.open"), new ImageIcon(Icons.getImage("Open", 16))) {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    openStory(VisualsUtils.askForFile(OpenBSTGUI.this, Lang.get("file.title")));
                }
            }));

    shortMenu.addSeparator();

    shortMenu.add(new JMenuItem(
            new AbstractAction(Lang.get("menu.create"), new ImageIcon(Icons.getImage("Add Property", 16))) {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    doNewEditor();
                }
            }));

    JMenu additionalMenu = new JMenu(Lang.get("menu.advanced"));
    shortMenu.add(additionalMenu);

    additionalMenu.add(new JMenuItem(
            new AbstractAction(Lang.get("menu.package"), new ImageIcon(Icons.getImage("Open Archive", 16))) {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    new PackageDialog(instance).setVisible(true);
                }
            }));
    additionalMenu.add(new JMenuItem(
            new AbstractAction(Lang.get("langcheck"), new ImageIcon(Icons.getImage("LangCheck", 16))) {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    final Map<String, String> languages = new Gson()
                            .fromJson(new InputStreamReader(
                                    OpenBST.class.getResourceAsStream(
                                            "/utybo/branchingstorytree/swing/lang/langs.json"),
                                    StandardCharsets.UTF_8), new TypeToken<Map<String, String>>() {
                                    }.getType());
                    languages.remove("en");
                    languages.remove("default");
                    JComboBox<String> jcb = new JComboBox<>(new Vector<>(languages.keySet()));
                    JPanel panel = new JPanel();
                    panel.add(new JLabel(Lang.get("langcheck.choose")));
                    panel.add(jcb);
                    int result = JOptionPane.showOptionDialog(OpenBSTGUI.this, panel, Lang.get("langcheck"),
                            JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
                    if (result == JOptionPane.OK_OPTION) {
                        Locale selected = new Locale((String) jcb.getSelectedItem());
                        if (!Lang.getMap().keySet().contains(selected)) {
                            try {
                                Lang.loadTranslationsFromFile(selected,
                                        OpenBST.class
                                                .getResourceAsStream("/utybo/branchingstorytree/swing/lang/"
                                                        + languages.get(jcb.getSelectedItem().toString())));
                            } catch (UnrespectedModelException | IOException e1) {
                                LOG.warn("Failed to load translation file", e1);
                            }
                        }
                        ArrayList<String> list = new ArrayList<>();
                        Lang.getLocaleMap(Locale.ENGLISH).forEach((k, v) -> {
                            if (!Lang.getLocaleMap(selected).containsKey(k)) {
                                list.add(k + "\n");
                            }
                        });
                        StringBuilder sb = new StringBuilder();
                        Collections.sort(list);
                        list.forEach(s -> sb.append(s));
                        JDialog dialog = new JDialog(OpenBSTGUI.this, Lang.get("langcheck"));
                        dialog.getContentPane().setLayout(new MigLayout());
                        dialog.getContentPane().add(new JLabel(Lang.get("langcheck.result")),
                                "pushx, growx, wrap");
                        JTextArea area = new JTextArea();
                        area.setLineWrap(true);
                        area.setWrapStyleWord(true);
                        area.setText(sb.toString());
                        area.setEditable(false);
                        area.setBorder(BorderFactory.createLoweredBevelBorder());
                        JScrollPane jsp = new JScrollPane(area);
                        jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
                        dialog.getContentPane().add(jsp, "pushx, pushy, growx, growy");
                        dialog.setSize((int) (Icons.getScale() * 300), (int) (Icons.getScale() * 300));
                        dialog.setLocationRelativeTo(OpenBSTGUI.this);
                        dialog.setModalityType(ModalityType.APPLICATION_MODAL);
                        dialog.setVisible(true);
                    }
                }
            }));

    additionalMenu.add(new JMenuItem(
            new AbstractAction(Lang.get("menu.debug"), new ImageIcon(Icons.getImage("Code", 16))) {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    DebugInfo.launch(OpenBSTGUI.this);
                }
            }));

    JMenu includedFiles = new JMenu("Included BST files");

    for (Entry<String, String> entry : OpenBST.getInternalFiles().entrySet()) {
        JMenuItem jmi = new JMenuItem(entry.getKey());
        jmi.addActionListener(ev -> {
            String path = "/bst/" + entry.getValue();
            InputStream is = OpenBSTGUI.class.getResourceAsStream(path);
            ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(OpenBSTGUI.this, "Extracting...",
                    is);
            new Thread(() -> {
                try {
                    File f = File.createTempFile("openbstinternal", ".bsp");
                    FileOutputStream fos = new FileOutputStream(f);
                    IOUtils.copy(pmis, fos);
                    openStory(f);
                } catch (final IOException e) {
                    LOG.error("IOException caught", e);
                    showException(Lang.get("file.error").replace("$e", e.getClass().getSimpleName())
                            .replace("$m", e.getMessage()), e);
                }

            }).start();

        });
        includedFiles.add(jmi);
    }
    additionalMenu.add(includedFiles);

    shortMenu.addSeparator();

    JMenu themesMenu = new JMenu(Lang.get("menu.themes"));
    shortMenu.add(themesMenu);
    themesMenu.setIcon(new ImageIcon(Icons.getImage("Color Wheel", 16)));
    ButtonGroup themesGroup = new ButtonGroup();
    JRadioButtonMenuItem jrbmi;

    jrbmi = new JRadioButtonMenuItem(Lang.get("menu.themes.dark"));
    if (0 == selectedTheme) {
        jrbmi.setSelected(true);
    }
    jrbmi.addActionListener(e -> switchLaF(0, DARK_THEME));
    themesMenu.add(jrbmi);
    themesGroup.add(jrbmi);

    jrbmi = new JRadioButtonMenuItem(Lang.get("menu.themes.light"));
    if (1 == selectedTheme) {
        jrbmi.setSelected(true);
    }
    jrbmi.addActionListener(e -> switchLaF(1, LIGHT_THEME));
    themesMenu.add(jrbmi);
    themesGroup.add(jrbmi);

    jrbmi = new JRadioButtonMenuItem(Lang.get("menu.themes.debug"));
    if (2 == selectedTheme) {
        jrbmi.setSelected(true);
    }
    jrbmi.addActionListener(e -> switchLaF(2, DEBUG_THEME));
    themesMenu.add(jrbmi);
    themesGroup.add(jrbmi);

    JMenu additionalLightThemesMenu = new JMenu(Lang.get("menu.themes.morelight"));
    int j = 3;
    for (Map.Entry<String, LookAndFeel> entry : ADDITIONAL_LIGHT_THEMES.entrySet()) {
        int jf = j;
        jrbmi = new JRadioButtonMenuItem(entry.getKey());
        if (j == selectedTheme)
            jrbmi.setSelected(true);
        jrbmi.addActionListener(e -> switchLaF(jf, entry.getValue()));
        additionalLightThemesMenu.add(jrbmi);
        themesGroup.add(jrbmi);
        j++;
    }
    themesMenu.add(additionalLightThemesMenu);

    JMenu additionalDarkThemesMenu = new JMenu(Lang.get("menu.themes.moredark"));
    for (Map.Entry<String, LookAndFeel> entry : ADDITIONAL_DARK_THEMES.entrySet()) {
        int jf = j;
        jrbmi = new JRadioButtonMenuItem(entry.getKey());
        if (j == selectedTheme)
            jrbmi.setSelected(true);
        jrbmi.addActionListener(e -> switchLaF(jf, entry.getValue()));
        additionalDarkThemesMenu.add(jrbmi);
        themesGroup.add(jrbmi);
        j++;
    }
    themesMenu.add(additionalDarkThemesMenu);

    shortMenu.add(new JMenuItem(
            new AbstractAction(Lang.get("menu.about"), new ImageIcon(Icons.getImage("About", 16))) {
                /**
                 *
                 */
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    new AboutDialog(instance).setVisible(true);
                }
            }));

    return shortMenu;
}