JInternalFrame - illegal component position











up vote
0
down vote

favorite












java 1.7



public class AccountsScroller extends JInternalFrame implements ActionListener, PaginationListener {


...

}



Here how I open InternalFrame from JFrame



    public void openInternalFrame(JInternalFrame newInternalFrame, Boolean isMaximize, Dimension dimension) {
try {
currentInternalFrame.setClosed(true);
currentInternalFrame = newInternalFrame;
addInternalFrame(currentInternalFrame, isMaximize, dimension);
} catch (PropertyVetoException ex) {
logger.error(ex.getMessage(), ex);
}
}



private JDesktopPane desktop;

desktop = new JDesktopPane();
private void addInternalFrame(JInternalFrame internalFrame, Boolean isMaximize, Dimension dimension) {
desktop.add(internalFrame); // 321 line
try {
internalFrame.setSelected(true);
if (isMaximize != null && isMaximize) {
internalFrame.setMaximum(true);
} else {
internalFrame.setSize(dimension);
}
} catch (java.beans.PropertyVetoException e) {
logger.error(e.getMessage(), e);
}
}


But when I again open it I get error:



   [java]     get_all_accounts rows = 2
[java] Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: illegal component position
[java] at java.awt.Container.addImpl(Container.java:1100)
[java] at javax.swing.JLayeredPane.addImpl(JLayeredPane.java:231)
[java] at javax.swing.JDesktopPane.addImpl(JDesktopPane.java:484)
[java] at java.awt.Container.add(Container.java:417)
[java] at myproject.com.MainScreenView.addInternalFrame(MainScreenView.java:321)
[java] at myproject.com.MainScreenView.openInternalFrame(MainScreenView.java:314)
[java] at myproject.com.MainScreenView.openInternalFrame(MainScreenView.java:307)
[java] at myproject.com.MainScreenView.actionPerformed(MainScreenView.java:230)
[java] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
[java] at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
[java] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
[java] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
[java] at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
[java] at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
[java] at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
[java] at java.awt.Component.processMouseEvent(Component.java:6533)
[java] at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
[java] at java.awt.Component.processEvent(Component.java:6298)
[java] at java.awt.Container.processEvent(Container.java:2236)
[java] at java.awt.Component.dispatchEventImpl(Component.java:4889)
[java] at java.awt.Container.dispatchEventImpl(Container.java:2294)
[java] at java.awt.Component.dispatchEvent(Component.java:4711)
[java] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
[java] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
[java] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
[java] at java.awt.Container.dispatchEventImpl(Container.java:2280)
[java] at java.awt.Window.dispatchEventImpl(Window.java:2746)`enter code here`









share|improve this question




















  • 1




    Post an Minimal, Complete, and Verifiable example that demonstrates the problem.
    – camickr
    Nov 10 at 20:03










  • MainScreenView.java:321 BTW - an MCVE of this problem should be Complete in much less than 321 lines of code.
    – Andrew Thompson
    Nov 10 at 23:04










  • I update my post: desktop.add(internalFrame);
    – Alexei
    Nov 11 at 8:09










  • Tip: Add @camickr (or whoever, the @ is important) to notify the person of a new comment. "I update my post:" Why didn't you wait till there was an MCVE before updating the post (with it)? I won't be giving this serious thought until I have code that compiles & runs.
    – Andrew Thompson
    Nov 12 at 1:03















up vote
0
down vote

favorite












java 1.7



public class AccountsScroller extends JInternalFrame implements ActionListener, PaginationListener {


...

}



Here how I open InternalFrame from JFrame



    public void openInternalFrame(JInternalFrame newInternalFrame, Boolean isMaximize, Dimension dimension) {
try {
currentInternalFrame.setClosed(true);
currentInternalFrame = newInternalFrame;
addInternalFrame(currentInternalFrame, isMaximize, dimension);
} catch (PropertyVetoException ex) {
logger.error(ex.getMessage(), ex);
}
}



private JDesktopPane desktop;

desktop = new JDesktopPane();
private void addInternalFrame(JInternalFrame internalFrame, Boolean isMaximize, Dimension dimension) {
desktop.add(internalFrame); // 321 line
try {
internalFrame.setSelected(true);
if (isMaximize != null && isMaximize) {
internalFrame.setMaximum(true);
} else {
internalFrame.setSize(dimension);
}
} catch (java.beans.PropertyVetoException e) {
logger.error(e.getMessage(), e);
}
}


But when I again open it I get error:



   [java]     get_all_accounts rows = 2
[java] Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: illegal component position
[java] at java.awt.Container.addImpl(Container.java:1100)
[java] at javax.swing.JLayeredPane.addImpl(JLayeredPane.java:231)
[java] at javax.swing.JDesktopPane.addImpl(JDesktopPane.java:484)
[java] at java.awt.Container.add(Container.java:417)
[java] at myproject.com.MainScreenView.addInternalFrame(MainScreenView.java:321)
[java] at myproject.com.MainScreenView.openInternalFrame(MainScreenView.java:314)
[java] at myproject.com.MainScreenView.openInternalFrame(MainScreenView.java:307)
[java] at myproject.com.MainScreenView.actionPerformed(MainScreenView.java:230)
[java] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
[java] at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
[java] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
[java] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
[java] at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
[java] at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
[java] at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
[java] at java.awt.Component.processMouseEvent(Component.java:6533)
[java] at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
[java] at java.awt.Component.processEvent(Component.java:6298)
[java] at java.awt.Container.processEvent(Container.java:2236)
[java] at java.awt.Component.dispatchEventImpl(Component.java:4889)
[java] at java.awt.Container.dispatchEventImpl(Container.java:2294)
[java] at java.awt.Component.dispatchEvent(Component.java:4711)
[java] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
[java] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
[java] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
[java] at java.awt.Container.dispatchEventImpl(Container.java:2280)
[java] at java.awt.Window.dispatchEventImpl(Window.java:2746)`enter code here`









share|improve this question




















  • 1




    Post an Minimal, Complete, and Verifiable example that demonstrates the problem.
    – camickr
    Nov 10 at 20:03










  • MainScreenView.java:321 BTW - an MCVE of this problem should be Complete in much less than 321 lines of code.
    – Andrew Thompson
    Nov 10 at 23:04










  • I update my post: desktop.add(internalFrame);
    – Alexei
    Nov 11 at 8:09










  • Tip: Add @camickr (or whoever, the @ is important) to notify the person of a new comment. "I update my post:" Why didn't you wait till there was an MCVE before updating the post (with it)? I won't be giving this serious thought until I have code that compiles & runs.
    – Andrew Thompson
    Nov 12 at 1:03













up vote
0
down vote

favorite









up vote
0
down vote

favorite











java 1.7



public class AccountsScroller extends JInternalFrame implements ActionListener, PaginationListener {


...

}



Here how I open InternalFrame from JFrame



    public void openInternalFrame(JInternalFrame newInternalFrame, Boolean isMaximize, Dimension dimension) {
try {
currentInternalFrame.setClosed(true);
currentInternalFrame = newInternalFrame;
addInternalFrame(currentInternalFrame, isMaximize, dimension);
} catch (PropertyVetoException ex) {
logger.error(ex.getMessage(), ex);
}
}



private JDesktopPane desktop;

desktop = new JDesktopPane();
private void addInternalFrame(JInternalFrame internalFrame, Boolean isMaximize, Dimension dimension) {
desktop.add(internalFrame); // 321 line
try {
internalFrame.setSelected(true);
if (isMaximize != null && isMaximize) {
internalFrame.setMaximum(true);
} else {
internalFrame.setSize(dimension);
}
} catch (java.beans.PropertyVetoException e) {
logger.error(e.getMessage(), e);
}
}


But when I again open it I get error:



   [java]     get_all_accounts rows = 2
[java] Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: illegal component position
[java] at java.awt.Container.addImpl(Container.java:1100)
[java] at javax.swing.JLayeredPane.addImpl(JLayeredPane.java:231)
[java] at javax.swing.JDesktopPane.addImpl(JDesktopPane.java:484)
[java] at java.awt.Container.add(Container.java:417)
[java] at myproject.com.MainScreenView.addInternalFrame(MainScreenView.java:321)
[java] at myproject.com.MainScreenView.openInternalFrame(MainScreenView.java:314)
[java] at myproject.com.MainScreenView.openInternalFrame(MainScreenView.java:307)
[java] at myproject.com.MainScreenView.actionPerformed(MainScreenView.java:230)
[java] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
[java] at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
[java] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
[java] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
[java] at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
[java] at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
[java] at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
[java] at java.awt.Component.processMouseEvent(Component.java:6533)
[java] at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
[java] at java.awt.Component.processEvent(Component.java:6298)
[java] at java.awt.Container.processEvent(Container.java:2236)
[java] at java.awt.Component.dispatchEventImpl(Component.java:4889)
[java] at java.awt.Container.dispatchEventImpl(Container.java:2294)
[java] at java.awt.Component.dispatchEvent(Component.java:4711)
[java] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
[java] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
[java] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
[java] at java.awt.Container.dispatchEventImpl(Container.java:2280)
[java] at java.awt.Window.dispatchEventImpl(Window.java:2746)`enter code here`









share|improve this question















java 1.7



public class AccountsScroller extends JInternalFrame implements ActionListener, PaginationListener {


...

}



Here how I open InternalFrame from JFrame



    public void openInternalFrame(JInternalFrame newInternalFrame, Boolean isMaximize, Dimension dimension) {
try {
currentInternalFrame.setClosed(true);
currentInternalFrame = newInternalFrame;
addInternalFrame(currentInternalFrame, isMaximize, dimension);
} catch (PropertyVetoException ex) {
logger.error(ex.getMessage(), ex);
}
}



private JDesktopPane desktop;

desktop = new JDesktopPane();
private void addInternalFrame(JInternalFrame internalFrame, Boolean isMaximize, Dimension dimension) {
desktop.add(internalFrame); // 321 line
try {
internalFrame.setSelected(true);
if (isMaximize != null && isMaximize) {
internalFrame.setMaximum(true);
} else {
internalFrame.setSize(dimension);
}
} catch (java.beans.PropertyVetoException e) {
logger.error(e.getMessage(), e);
}
}


But when I again open it I get error:



   [java]     get_all_accounts rows = 2
[java] Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: illegal component position
[java] at java.awt.Container.addImpl(Container.java:1100)
[java] at javax.swing.JLayeredPane.addImpl(JLayeredPane.java:231)
[java] at javax.swing.JDesktopPane.addImpl(JDesktopPane.java:484)
[java] at java.awt.Container.add(Container.java:417)
[java] at myproject.com.MainScreenView.addInternalFrame(MainScreenView.java:321)
[java] at myproject.com.MainScreenView.openInternalFrame(MainScreenView.java:314)
[java] at myproject.com.MainScreenView.openInternalFrame(MainScreenView.java:307)
[java] at myproject.com.MainScreenView.actionPerformed(MainScreenView.java:230)
[java] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
[java] at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
[java] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
[java] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
[java] at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
[java] at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
[java] at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
[java] at java.awt.Component.processMouseEvent(Component.java:6533)
[java] at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
[java] at java.awt.Component.processEvent(Component.java:6298)
[java] at java.awt.Container.processEvent(Container.java:2236)
[java] at java.awt.Component.dispatchEventImpl(Component.java:4889)
[java] at java.awt.Container.dispatchEventImpl(Container.java:2294)
[java] at java.awt.Component.dispatchEvent(Component.java:4711)
[java] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
[java] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
[java] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
[java] at java.awt.Container.dispatchEventImpl(Container.java:2280)
[java] at java.awt.Window.dispatchEventImpl(Window.java:2746)`enter code here`






java swing illegalargumentexception jinternalframe






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 8:09

























asked Nov 10 at 18:36









Alexei

1,039923




1,039923








  • 1




    Post an Minimal, Complete, and Verifiable example that demonstrates the problem.
    – camickr
    Nov 10 at 20:03










  • MainScreenView.java:321 BTW - an MCVE of this problem should be Complete in much less than 321 lines of code.
    – Andrew Thompson
    Nov 10 at 23:04










  • I update my post: desktop.add(internalFrame);
    – Alexei
    Nov 11 at 8:09










  • Tip: Add @camickr (or whoever, the @ is important) to notify the person of a new comment. "I update my post:" Why didn't you wait till there was an MCVE before updating the post (with it)? I won't be giving this serious thought until I have code that compiles & runs.
    – Andrew Thompson
    Nov 12 at 1:03














  • 1




    Post an Minimal, Complete, and Verifiable example that demonstrates the problem.
    – camickr
    Nov 10 at 20:03










  • MainScreenView.java:321 BTW - an MCVE of this problem should be Complete in much less than 321 lines of code.
    – Andrew Thompson
    Nov 10 at 23:04










  • I update my post: desktop.add(internalFrame);
    – Alexei
    Nov 11 at 8:09










  • Tip: Add @camickr (or whoever, the @ is important) to notify the person of a new comment. "I update my post:" Why didn't you wait till there was an MCVE before updating the post (with it)? I won't be giving this serious thought until I have code that compiles & runs.
    – Andrew Thompson
    Nov 12 at 1:03








1




1




Post an Minimal, Complete, and Verifiable example that demonstrates the problem.
– camickr
Nov 10 at 20:03




Post an Minimal, Complete, and Verifiable example that demonstrates the problem.
– camickr
Nov 10 at 20:03












MainScreenView.java:321 BTW - an MCVE of this problem should be Complete in much less than 321 lines of code.
– Andrew Thompson
Nov 10 at 23:04




MainScreenView.java:321 BTW - an MCVE of this problem should be Complete in much less than 321 lines of code.
– Andrew Thompson
Nov 10 at 23:04












I update my post: desktop.add(internalFrame);
– Alexei
Nov 11 at 8:09




I update my post: desktop.add(internalFrame);
– Alexei
Nov 11 at 8:09












Tip: Add @camickr (or whoever, the @ is important) to notify the person of a new comment. "I update my post:" Why didn't you wait till there was an MCVE before updating the post (with it)? I won't be giving this serious thought until I have code that compiles & runs.
– Andrew Thompson
Nov 12 at 1:03




Tip: Add @camickr (or whoever, the @ is important) to notify the person of a new comment. "I update my post:" Why didn't you wait till there was an MCVE before updating the post (with it)? I won't be giving this serious thought until I have code that compiles & runs.
– Andrew Thompson
Nov 12 at 1:03

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242187%2fjinternalframe-illegal-component-position%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242187%2fjinternalframe-illegal-component-position%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues