2012-08-22 13 views
6

के माध्यम से देखे जाने पर अनचाहे JInternalFrame सजाया जाता है मुझे JInternalFrame कार्यान्वयन के साथ समस्या का सामना करना पड़ रहा है। मैंने JInternalFrame को अनियंत्रित किया है, ताकि JInternalFrame की शीर्षक पट्टी और सीमा हटा दी जा सके। समस्या निम्न परिदृश्य में होती है।रिमोट डेस्कटॉप शेयरिंग

  1. विंडोज 7 मशीन में प्रोग्राम निष्पादित करें।

    • इस बिंदु पर JInternalFrame अव्यवस्थित रहता है।
  2. से दूरस्थ डेस्कटॉप साझाकरण का उपयोग कर विंडोज 7 मशीन तक पहुंचें।

    • अब आंतरिक फ्रेम की शीर्षक पट्टी और सीमा दिखाई दे रही है।

यह समस्या Windows XP में केवल विंडोज 7 मशीन में होता है और नहीं। आप किसी अन्य विंडोज 7 मशीन या विंडोज एक्सपी मशीन से दूरस्थ डेस्कटॉप साझाकरण का उपयोग कर विंडोज 7 मशीन तक पहुंच सकते हैं।

यदि आप पहले दूरस्थ डेस्कटॉप साझाकरण का उपयोग कर मशीन तक पहुंचते हैं, और फिर प्रोग्राम निष्पादित करते हैं, तो JInternalFrame अव्यवस्थित रहता है।

कदम पुन: पेश करने

चरण 1: एक विंडोज 7 मशीन में आवेदन निष्पादित।

चरण 2: किसी अन्य विंडोज 7 या विंडोज एक्सपी मशीन से दूरस्थ डेस्कटॉप साझाकरण का उपयोग कर विंडोज 7 मशीन तक पहुंचें।

चरण 3: आवेदन

परिणाम के जीयूआई की जाँच करें: - शीर्षक पट्टी और सीमा असज्जित JInternalFrame के दिखाई देने लगता है।

अगर किसी को इस समस्या का सामना करना पड़ा है या यदि किसी के पास इस मुद्दे का समाधान है, तो कृपया अपने विचार साझा करें।

एक नमूना कोड जिसका उपयोग आप इस मुद्दे को पुन: उत्पन्न कर सकते हैं नीचे दिया गया है।

/* 
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. 
* 
* Redistribution and use in source and binary forms, with or without 
* modification, are permitted provided that the following conditions 
* are met: 
* 
* - Redistributions of source code must retain the above copyright 
*  notice, this list of conditions and the following disclaimer. 
* 
* - Redistributions in binary form must reproduce the above copyright 
*  notice, this list of conditions and the following disclaimer in the 
*  documentation and/or other materials provided with the distribution. 
* 
* - Neither the name of Oracle or the names of its 
*  contributors may be used to endorse or promote products derived 
*  from this software without specific prior written permission. 
* 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
*/ 

import javax.swing.JInternalFrame; 
import javax.swing.JDesktopPane; 
import javax.swing.JMenu; 
import javax.swing.JMenuItem; 
import javax.swing.JMenuBar; 
import javax.swing.JFrame; 
import javax.swing.KeyStroke; 
import javax.swing.plaf.basic.BasicInternalFrameTitlePane; 
import javax.swing.plaf.basic.BasicInternalFrameUI; 

import java.awt.event.*; 
import java.awt.*; 

/* 
* InternalFrameDemo.java requires: 
* MyInternalFrame.java 
*/ 
public class InternalFrameDemo extends JFrame 
           implements ActionListener { 
    JDesktopPane desktop; 

    public InternalFrameDemo() { 
     super("InternalFrameDemo"); 

     //Make the big window be indented 50 pixels from each edge 
     //of the screen. 
     int inset = 50; 
     Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 
     setBounds(inset, inset, 
        screenSize.width - inset*2, 
        screenSize.height - inset*2); 

     //Set up the GUI. 
     desktop = new JDesktopPane(); //a specialized layered pane 
     createFrame(); //create first "window" 
     setContentPane(desktop); 
     setJMenuBar(createMenuBar()); 

     //Make dragging a little faster but perhaps uglier. 
     desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); 
    } 

    protected JMenuBar createMenuBar() { 
     JMenuBar menuBar = new JMenuBar(); 

     //Set up the lone menu. 
     JMenu menu = new JMenu("Document"); 
     menu.setMnemonic(KeyEvent.VK_D); 
     menuBar.add(menu); 

     //Set up the first menu item. 
     JMenuItem menuItem = new JMenuItem("New"); 
     menuItem.setMnemonic(KeyEvent.VK_N); 
     menuItem.setAccelerator(KeyStroke.getKeyStroke(
       KeyEvent.VK_N, ActionEvent.ALT_MASK)); 
     menuItem.setActionCommand("new"); 
     menuItem.addActionListener(this); 
     menu.add(menuItem); 

     //Set up the second menu item. 
     menuItem = new JMenuItem("Quit"); 
     menuItem.setMnemonic(KeyEvent.VK_Q); 
     menuItem.setAccelerator(KeyStroke.getKeyStroke(
       KeyEvent.VK_Q, ActionEvent.ALT_MASK)); 
     menuItem.setActionCommand("quit"); 
     menuItem.addActionListener(this); 
     menu.add(menuItem); 

     return menuBar; 
    } 

    //React to menu selections. 
    public void actionPerformed(ActionEvent e) { 
     if ("new".equals(e.getActionCommand())) { //new 
      createFrame(); 
     } else { //quit 
      quit(); 
     } 
    } 

    //Create a new internal frame. 
    protected void createFrame() { 
     MyInternalFrame frame = new MyInternalFrame(); 
     frame.setVisible(true); //necessary as of 1.3 
     desktop.add(frame); 
     try { 
      frame.setSelected(true); 
     } catch (java.beans.PropertyVetoException e) {} 
    } 

    //Quit the application. 
    protected void quit() { 
     System.exit(0); 
    } 

    /** 
    * Create the GUI and show it. For thread safety, 
    * this method should be invoked from the 
    * event-dispatching thread. 
    */ 
    private static void createAndShowGUI() { 
     //Make sure we have nice window decorations. 
     JFrame.setDefaultLookAndFeelDecorated(true); 

     //Create and set up the window. 
     InternalFrameDemo frame = new InternalFrameDemo(); 
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 

     //Display the window. 
     frame.setVisible(true); 
    } 

    public static void main(String[] args) { 
     //Schedule a job for the event-dispatching thread: 
     //creating and showing this application's GUI. 
     javax.swing.SwingUtilities.invokeLater(new Runnable() { 
      public void run() { 
       createAndShowGUI(); 
      } 
     }); 
    } 
} 

/* Used by InternalFrameDemo.java. */ 
@SuppressWarnings("serial") 
class MyInternalFrame extends JInternalFrame { 
    static int openFrameCount = 0; 
    static final int xOffset = 30, yOffset = 30; 

    public MyInternalFrame() { 
     super("Document #" + (++openFrameCount), 
       true, //resizable 
       true, //closable 
       true, //maximizable 
       true);//iconifiable 

     //...Create the GUI and put it in the window... 

     //...Then set the window size or call pack... 
     setSize(300,300); 
     // Undecorating the internal frame 
     BasicInternalFrameTitlePane titlePane = 
      (BasicInternalFrameTitlePane) ((BasicInternalFrameUI) this.getUI()). 
      getNorthPane(); 
     this.remove(titlePane); 
     this.setBorder(null); 
     //Set the window's location. 
     setLocation(xOffset*openFrameCount, yOffset*openFrameCount); 
    } 
} 
+0

सवाल यह है, की कोशिश आप एक आंतरिक फ्रेम का उपयोग करना है? यदि यह अवांछित है, तो क्या आप इसके बजाय 'जेपीनल' का उपयोग कर सकते हैं? – MadProgrammer

+0

मुझे जेइनरलफ्रेम का उपयोग करना होगा। आवेदन दो मोड का समर्थन करता है। एक मोड में केवल एक ही आंतरिक फ्रेम होगा जो अनिश्चित है। दूसरे मोड में, कई आंतरिक फ्रेम हो सकते हैं, जिन्हें सजाया जाता है। –

+3

https://forums.oracle.com/forums/thread.jspa?threadID=2430018&tstart=0 –

उत्तर

3

आप के रूप InternalFrame उदाहरण के लिए नहीं साझा .setUndecorated (सही) असज्जित संपत्ति डाल करने के लिए की जरूरत है।

या

JInternalFrame frame = new JInternalFrame("frame", false, false, false, false); 
frame.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE); 
frame.getRootPane().setWindowDecorationStyle(JRootPane.NONE); 
संबंधित मुद्दे