Hi Stefan,
You have wandered into deep waters, and I have no life preserver to toss
to you except the advice that it might be easier if you could reorganize
your Histogram functionality so that it doesn't have to launch dialogs from
your own frame. Failing that, you may need to extend JInternalFrame rather
than instantiating one.
regards,
Larry
On 10/27/07, Stefan Steiniger <[EMAIL PROTECTED]> wrote:
>
> Hei Guys,
>
> as I am not firm at all with GUI programming it would be nice if
> somebody could help me with the new Histogram function.
>
> What do I do:
> 1) created a threaded plugin
> 2) obtain in "execute" some params (Attribute type and number of ranges)
> 2) call inside "run" the following code that creates a Histogram Plot
> (note: i use jmathplot library)
>
> final Plot2DPanel plot = new Plot2DPanel();
> plot.addHistogramPlot(this.selAttribute, data, this.ranges);
> JInternalFrame frame = new JInternalFrame("Histogram");
> frame.setLayout(new BorderLayout());
> frame.add(plot, BorderLayout.CENTER);
> frame.setVisible(true);
> context.getWorkbenchFrame().addInternalFrame(frame);
>
>
> the problem:
> ============
> The Plot-panel/Frame for the Histogram contains buttons that activate
> some other dialogs. For instance a FileChooser to save the plot as png
> image.
> If I activate the button the new dialog is only partly visible and the
> openjump GUI is not redrawn while moving the dialog. (see attached
> image). Interestingly the histogram plot panel seems to be redrawn but
> not the histogram frame.
>
> I tried as well to make a new menu within the Histogram Frame with the
> code below. But the problem persists, i.e. the FileChooser is only
> partly visible and causes graphical errors to the JUMP GUI.
>
>
> Any idea how avoid that the SaveDialog (or any other dialog called)
> causes graphical errors (i guess threading is the solution - but how?)
>
>
> stefan
>
> source-code for calling file dialog and saving the plot-image:
> ======================================
> JMenuBar menuBar = new JMenuBar();
> frame.setJMenuBar(menuBar);
> JMenu mTools = new JMenu("Tools");
> menuBar.add(mTools);
>
> mTools.add(new AbstractAction("Save Image as PNG File",
> IconLoader.icon("disk.png")) {
> public void actionPerformed(ActionEvent e){
> java.io.File file =
> CreateHistogramPlugIn.selectFile(context);
> if (file != null){plot.toGraphicFile(file);}
> });
>
> ======= using: =================
> public static File selectFile(PlugInContext context){
> JFileChooser fc =
> GUIUtil.createJFileChooserWithOverwritePrompting("png");
> fc.showSaveDialog(context.getWorkbenchFrame());
> File file = fc.getSelectedFile();
> try{
> String name = file.getPath();
> name = CreateHistogramPlugIn.addExtension(name,"png");
> File newFile = new File(name);
> return newFile;
> }
> catch(Exception e){
> return null;
> }
> }
> =====================================
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
>
--
http://amusingprogrammer.blogspot.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel