studio.ui.HelpDialog Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kdbStudio Show documentation
Show all versions of kdbStudio Show documentation
Studio for kdb+ is a rapid development environment for the ultra-fast database kdb+ from Kx Systems: http://www.kx.com.
package studio.ui;
import studio.kdb.Lm;
import studio.utils.BrowserLaunch;
import studio.utils.log4j.EnvConfig;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class HelpDialog extends JDialog {
public HelpDialog(JFrame parent) {
super(parent, "Studio for kdb+");
String env = EnvConfig.getEnvironment();
final JEditorPane jep = new JEditorPane("text/html",
"Studio for kdb+ Studio for kdb+
"
+ ""
+ (env == null ? "" : "Environment: " + env + "
")
+ "Version: " + Lm.version + " (" + Lm.date + ")"
+ "
Build date: " + Lm.build
+ "
JVM Version: " + System.getProperty("java.version")
+ "
License: Apache 2"
+ "
N.B. Some components have their own license terms, see this project on github for details."
+ "
Source available from Github"
+ "
The repository was forked from Github"
+ "
Contributions and corrections welcome."
+ "
Notes
"
+ Lm.notes
+ "");
jep.setEditable(false);
jep.setOpaque(true);
jep.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent hle) {
if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType()))
BrowserLaunch.openURL(hle.getURL().toString());
}
});
jep.setBorder(BorderFactory.createEmptyBorder(10,20,10,20));
jep.setCaretPosition(0);
getContentPane().add(new JScrollPane(jep));
JPanel buttonPane = new JPanel();
JButton button = new JButton("Close");
buttonPane.add(button);
button.addActionListener(new CloseActionListener());
getContentPane().add(buttonPane, BorderLayout.PAGE_END);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setPreferredSize(new Dimension(800,450));
pack();
setVisible(true);
}
@Override
public JRootPane createRootPane() {
JRootPane rootPane = new JRootPane();
KeyStroke stroke = KeyStroke.getKeyStroke("ESCAPE");
Action action = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
setVisible(false);
dispose();
}
};
InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(stroke, "ESCAPE");
rootPane.getActionMap().put("ESCAPE", action);
return rootPane;
}
class CloseActionListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
setVisible(false);
dispose();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy