Hi,
You do not seem to have much experience writing Java code, unfortunately I do not have time to review your entire Java code, my purpose here is just to help you with advice using our Oxygen specific APIs, not to help you with building custom Swing components.
Just a couple of observations, code like this:
Code: Select all
JFrame f = new JFrame("Test123");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
TableExample tableData = new TableExample();
f.setContentPane(tableData.getGUI());
The TableExample is also a JFrame, you could just configure and show it directly. Because right now the method "com.oxygenxml.sdksamples.workspace.TableExample.getGUI()" returns the JFrame and then you place the JFrame in another JFrame.
This code:
Code: Select all
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
instructs the operating system to force close the entire Java application when the end user closes the frame. So once the end user closes this custom frame of yours the entire Oxygen application will be force closed.
Are you sure you want to use JFrame and not some modal dialogs (JDialog) which block the application until the end user chooses content in them?
I would suggest also removing this code:
Code: Select all
try {
// Significantly improves the look of the output in
// terms of the file names returned by FileSystemView!
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception weTried) {
}
Your code runs in Oxygen, it is not a standalone Swing application. Oxygen sets up its own color theme, look and feel.
Coming back to your original request:
here the requirement is , in the step3 of Jframe I want to access if any table row selected from the Jframe opened in step 2.
A way to do this would be to keep the "tableData" as a field, once it's a field you can access it also from the other "MenuItem2Action".
Code: Select all
private TableExample tableData;
@SuppressWarnings("serial")
private AbstractAction createMenuItem1Action(StandalonePluginWorkspace pluginWorkspaceAccess) {
return new AbstractAction("MenuItem1Action") {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
// Significantly improves the look of the output in
// terms of the file names returned by FileSystemView!
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception weTried) {
}
JFrame f = new JFrame("Test123");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
tableData = new TableExample();
f.setContentPane(tableData.getGUI());
Regards,
Radu