This class doesn't run with my current version of the source code, but as far as I can tell, it looks like you're just going for a way to pull the components out of the JFrame to use in some other window or frame. If you're trying to make a customized frame, you're probably better off extending the HyperFrame class. If extending the HyperFrame class doesn't work for what you want to do, let me know what you are going for, and I will see if I can accommodate your needs.
Cheers,
Jere
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a purpose to exploit two java application programmes. The first one will be the Hypernotes which should be consummated . The other one will be an java application programme which already has it's user interface and some other functions.I want to embed the Hypernotes sourcecode to the java application programme ,so the java application programme can interpret the files which the Hypernotes saved.
So I want to embed our Hypernotes into another java application programme. So the problem comes. The java application programme already has a "JFrame" as the user interface. So I have to change the HyperFrame of the Hypernotes frome a JFrame to a JPanel. After delete and change some sourcecodes,for example:I delete the menubar ; I add a "Open2" item to the popmenu which has had the itum "Create New", "Delete", "Rename" ,I want to open a saved file through this "Open2" item.
And then the main function likes following:
public class MainTest {
public static void main(String[] args){
But the result is:The Hypernotes'interface can be seen in the UI,but when I try to use the "Open2" to open a saved file, it catches the following information:
"Couldn't load from the file"
How can I to do ?
My purpose is above. May be the above source codes have some unknown problems.But how to
achieve my purpose ?
Realy appreciated for your help!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
import java.util.Iterator;
import gui.HyperFrame;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import data.FileHandler;
import data.Node;
import data.NodeTree;
public class testclass extends JFrame {
/**
* @param args
*/
public static NodeTree nodeTree;
public static void main(String[] args) {
// TODO 自动生成方法存根
nodeTree = new NodeTree();
Node n = new Node("New File");
nodeTree.getRootNode().addChild(n);
FileHandler.loadedFileName = null;
HyperFrame hf = HyperFrame.getActiveFrame();
if(hf == null)
hf = new HyperFrame();
hf.setNode(n);
hf.setVisible(true);
JFrame jframe = new JFrame();
JMenuBar menuBar =jframe.getJMenuBar();
menuBar=hf.updateMenuBar();
jframe.setJMenuBar(menuBar);
JPanel ContentPane = (JPanel)hf.getContentPane();
jframe.setContentPane(ContentPane);
jframe.setSize(400,400);
jframe.setTitle("TestDemo");
jframe.setVisible(true);
}
}
It hasn't the listener event .why?
This class doesn't run with my current version of the source code, but as far as I can tell, it looks like you're just going for a way to pull the components out of the JFrame to use in some other window or frame. If you're trying to make a customized frame, you're probably better off extending the HyperFrame class. If extending the HyperFrame class doesn't work for what you want to do, let me know what you are going for, and I will see if I can accommodate your needs.
Cheers,
Jere
I have a purpose to exploit two java application programmes. The first one will be the Hypernotes which should be consummated . The other one will be an java application programme which already has it's user interface and some other functions.I want to embed the Hypernotes sourcecode to the java application programme ,so the java application programme can interpret the files which the Hypernotes saved.
So I want to embed our Hypernotes into another java application programme. So the problem comes. The java application programme already has a "JFrame" as the user interface. So I have to change the HyperFrame of the Hypernotes frome a JFrame to a JPanel. After delete and change some sourcecodes,for example:I delete the menubar ; I add a "Open2" item to the popmenu which has had the itum "Create New", "Delete", "Rename" ,I want to open a saved file through this "Open2" item.
And then the main function likes following:
public class MainTest {
public static void main(String[] args){
JFrame jframe = new JFrame();
jframe.setTitle("Test");
JPanel contentpane = (JPanel)jframe.getContentPane();
HyperFrame hf = HyperFrame.getActiveFrame();
if(hf == null)
hf = new HyperFrame();
hf.setNode(n);
contentpane.add(hf);
jframe.setSize(200,200);
jframe.setVisible(true);
}
}
But the result is:The Hypernotes'interface can be seen in the UI,but when I try to use the "Open2" to open a saved file, it catches the following information:
"Couldn't load from the file"
How can I to do ?
My purpose is above. May be the above source codes have some unknown problems.But how to
achieve my purpose ?
Realy appreciated for your help!