This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

My GUI be affected by RMI???!!!  RSS feed

 
AutinHorse
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I define a 'DataAccess' interfce first,then use a local data access class and another RMI interface implements or extends it. In the 'main' method, choose to use local or RMI according to arguments, then cast it to DataAccess, then use it as parameter to initial GUI. GUI use JFrame and some JOptionPane to show message to user.
Now no problem for use the local data class, but when I use the RMI, the Frame window has a column at the bottom of the window, show 'Java applet window', all the JOptionPanes be shown by 'showConfirmDialog' are same, and all the JOptionPanes be shown by 'showMessageDialog' dispear.
The only different are four lines on the main method, to choose local or RMI, but why the windows be different.
The code are as follow (I delete the try-catch block):
public static void main( String[] args ) {
remote();
//local();
}
static void local() {
DataAccess data = new LocalData();
ClientGUI tm = new ClientGUI ( data );
tm.show();
}
static void remote() {
System.setSecurityManager( new RMISecurityManager() );
String url = "rmi://localhost:1099/";
ServerData c1 = (ServerData) Naming.lookup( url + "DataServer" );
DataAccess data = (DataAccess) c1;
ClientGUI tm = new ClientGUI ( data );
tm.show();
}
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe it has to do with RMISecurityManager and the policy file.
There are a few posts here that already address the solution to this problem. Try doing search on Applet. I just forgot the answer, otherwise I would type it here
Mark
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!