My listing program can't execute normally, Please HELP me
Hello,
I am in trouble, this is my listing program:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.event.*;
import javax.swing.border.*;
class Server extends JFrame implements DocumentListener, ActionListener
private JPanel panel1;
private JPanel panel2;
private JTextField field1;
private JTextField field2;
private JTextField field3;
private JLabel label1;
private JLabel label2;
private JLabel label3;
private JButton button1;
private JButton button2;
private JOptionPane pane1;
public Server()
super("Server");
setTitle( "Port" );
setSize( 640, 480 );
setBackground( Color.gray );
JPanel topPanel = new JPanel();
topPanel.setLayout(new GridLayout(2,2));
getContentPane().add( topPanel );
panel1.setLayout(null);
panel2.setLayout(null);
/* --- Panel Message Server --- */
// Components
JTextField field1 = new JTextField();
field1.setBounds(150,40,100,25);
field1.setFocusAccelerator('a');
panel1.add(field1);
JLabel label1 = new JLabel("Port Number:");
label1.setBounds(60, 40, 260, 20);
label1.setLabelFor(field1);
label1.setDisplayedMnemonic('A');
panel1.add(label1);
Border etched;
etched = BorderFactory.createEtchedBorder();
TitledBorder title;
title = BorderFactory.createTitledBorder(etched, "Message Server");
title.setTitleJustification(TitledBorder.LEFT);
panel1.setBorder(title);
topPanel.add(panel1);
/* --- Panel Radius Server --- */
// Components
JTextField field2 = new JTextField();
field2.setBounds(170, 40, 100, 25);
field2.setFocusAccelerator('b');
panel2.add(field2);
JLabel label2 = new JLabel("Authorized Port:");
label2.setBounds(60, 40, 260, 20);
label2.setLabelFor(field2);
label2.setDisplayedMnemonic('B');
panel2.add(label2);
JTextField field3 = new JTextField(10);
field3.setBounds(170, 80, 100, 25);
field3.setFocusAccelerator('c');
panel2.add(field3);
JLabel label3 = new JLabel("Account Port:");
label3.setBounds(60, 80, 260, 20);
label3.setLabelFor(field3);
label3.setDisplayedMnemonic('C');
panel2.add(label3);
Border etched2;
etched2 = BorderFactory.createEtchedBorder();
TitledBorder title2;
title2 = BorderFactory.createTitledBorder(etched2, "Radius Server");
title2.setTitleJustification(TitledBorder.LEFT);
panel2.setBorder(title2);
topPanel.add(panel2);
/* --- Button components --- */
JPanel leftcolumn3 = new JPanel();
leftcolumn3.add(button1);
button1.setEnabled(false);
JPanel rightcolumn3 = new JPanel();
rightcolumn3.add(button2);
JPanel ButtonPanel = new JPanel();
//ButtonPanel.setLayout(new BorderLayout());
ButtonPanel.add(button1);
ButtonPanel.add(button2);
topPanel.add(ButtonPanel);
// Add a document listener to the first field
Document document = field1.getDocument();
document.addDocumentListener( this );
// Handle keyboard accelerators
public void actionPerformed( ActionEvent e )
// Get the source of the action event
JLabel label = (JLabel)e.getSource();
// Give the associated component the focus
Component fieldComponent = label.getLabelFor();
fieldComponent.requestFocus();
// Handle insertions into the text field
public void insertUpdate( DocumentEvent event )
String sString = field1.getText();
try
int iValue = Integer.parseInt( sString );
button1.setEnabled( true );
catch( NumberFormatException e )
JOptionPane.showMessageDialog(pane1,
"Invalid password. Try again.",
"Error Message",
JOptionPane.ERROR_MESSAGE);
// Handle deletions from the text field
public void removeUpdate( DocumentEvent event )
// Prevent the user from entering a blank field
if( field1.getText().length() == 0 )
button1.setEnabled( false );
else
// Do the same error checking as insertUpdate()
insertUpdate( event );
// Handle changes to the text field
public void changedUpdate( DocumentEvent event )
// Nothing to do here
public static void main( String args[] )
// Create an instance of the test application
Server window = new Server();
window.setVisible( true );
If I execute this file will appear command like:
" Exception in thread "main" java.lang.NullPointerException
at server.<init><server.java:39>
at server.main<server.java:188> "
Would you help me? please get out me from this problem.
thank's
If I execute this file will appear command like:
" Exception in thread "main"
java.lang.NullPointerException
at server.<init><server.java:39></server>
at server.main<server.java:188></server> "The first thing you need to do is take a look at line 39 in server.java. This is where you are getting your NullPointerException. At a guess I'd say its the following line
panel1.setLayout(null);You don't appear to be assigning any value to panel1 before trying to call a method on it.
Col
Similar Messages
-
I have a spelling app that is stuck on the screen - it doesn't have any way to close it out, and when I split the screen and go to "Finder" to remove it, it says that it can't, because the program is still open. Please help.
Paul,
I'm sure this is the correct answer, but just switched to Apple, so am just an apple seed at this point! :~)
How do I get to the Apple Menu?
Thanks!
KL -
I sent out an email to a group of 5 and addressed it to myself- it appears to have gone to my whole contact list- how can I sort this please?
Nope, not strange at all. No system should try to be all things to all people.
Actually, there is a way to do this: After creating a group message, save the conversation and add new messages it when necessary.
If you want to suggest someting to Apple, post it here:
Apple - iPhone - Feedback -
Error installing Adobe in Program Files... PLEASE HELP!
Hi,
I´m trying to install the trial of Adobe CS6 Master Collection (FOR PC) in the folder Program files and I always get this message:
"download may fail to this folder due to restrictive access privileges. Please select a different folder."
I´ve tried installing it in another folders and the problem is the same... If I try to install it in a completely different place (as the desktop), it initially lets me but after that, when the installation starts, it says that there is the error 109 and that I cannot install...
WHAT CAN I DO? PLEASE HELP!
Thank you very much.We cannot know, but it sounds like you simply don't have the proper user privileges and are not the administrator. This is nothing Adobe can fix for you. Talk to your IT department/ the computer owner or if in fact you are your own admin, log in with a proper account and turn off security tools and whatnot...
Mylenium -
I just opened up my MacBook Pro after a few days of not using it and it was frozen. I turned it off and back on and all I see is a white screen, there was a file with a question mark flashing for a bit but I can't do anything, please help me!!
Jerricayoung,
you have a 13-inch Mid 2012 MacBook Pro. It’s modern enough that it supports booting into Recovery mode. To do so, hold down a Command key and the R key as you start up. It should eventually show a Mac OS X Utilities menu. Select Disk Utility from that menu; when the Disk Utility window appears, select the bootable volume from the left-hand side of the window. (It’s typically called “Macintosh HD”.) When the volume is selected, some buttons will appear on the right-hand side. If it’s not greyed out, press the Verify Disk button; if it is greyed out, or if it reports on errors that it found, press the Repair Disk button. Once the verification/repair is completed, exit Disk Utility and select Restart from the Apple menu; that will restart your MacBook Pro in its normal mode. With luck, that will be enough to get you to your normal login screen, rather than the white screen. -
I have paid for Creative Cloud - illustrator CC 1 year monthly plan, but it still show "Trial Expired". I have tried to sign in and sign out creative cloud many times, but still can't work. Please help!
Does your Cloud subscription show on your account page?
https://www.adobe.com/account.html for subscriptions on your Adobe page
Also,
This is an open forum, not Adobe support... you need Adobe support to help
Adobe contact information - http://helpx.adobe.com/contact.html
-Select your product and what you need help with
-Click on the blue box "Still need help? Contact us" -
My itunes will not work at all. i have deleted and reinstalled in over ten times, i have ended the process, i have reinstalled quicktime i few times, i have deleted many folders such as TEMP, itunes helper et What else can i do? Please help:(
Now it sometimes keeps coming up and working but once i plug an ipod in it freezes my whole computer up and no i dont get any response from itunes at all
-
My iPhone 5 won't stop scrolling through songs and I can't stop it please help !! :(
settings - general - usuage - music - delete. Then do a reset, hold down the home/sleep button together until you see the apple logo and then release, then wait for the phone to boot back up.
Then sync the music back via iTunes. -
i forgot my icloud account and my email how can i recover it please help me icloud maker and icloud password and username holder
If you don't know your ID, you can try to find it as explained here: http://support.apple.com/kb/HT5625. Then you can reset the password as explained here: http://support.apple.com/kb/PH2617. Of course, you can only do this if it's your ID.
-
My wife and I share the same apple id, we just updated our iphones. When we were asked if we wanted to share the same apple id for icloud we said yes, now our phones can't face time, please help?
Read http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
If you wish to share an Apple ID with family members then read: http://www.macstories.net/stories/ios-5-icloud-tips-sharing-an-apple-id-with-you r-family/ -
My iPod Touch 4th generation just won't download apps. I have tried everything I can think of. Please help!
Hi, when you say you have tried everything... I presume you have gone into Settings > Store and logged out and back in with your account details?
You could try purchasing an app via iTunes to see if its an issue with the device or the account you're using.
Hope this helps. -
Hello! I was on my Mac and then I clicked on iTunes. Then I clicked on Account, and accidentally removed my device from my Mac, how can I get it back? Also when I plug my iPod into the computer, it downloads everything that is on my computer, how can I stop this. please help! please help!!!!!!thank you
Is the iPod still singed into the account isn Settings>iTunes and App Stores and SettingsZ>iCloudl? If it is then I would not be concerned.
Also see:
iTunes Store: Associating a device or computer to your Apple ID
since you may have started the 90 day window.
For the other "problem", go to iTunes>Preferences>Devices and check the box that says Prevent iPod....automatically syncing. -
am using iphone 3g and it is having currently IOS 4.1 version,till what IOS version can i upgrade ? please help me many of my apps are not working esp whatsapp.
iOS 4.2.1 is the latest version of iOS for the 3G.
Facebook and Whatsapp both require 4.3 or higher.
If you want to use those apps, either use the old version that should be in your iTunes library or upgrade the hardware to a 3GS or newer device. -
My iphone 4 of ios 7.1.1 sim card has not working from since yesterday, it always shows searching whenever i insert sim in it, i do it again and again, but it cant be fix. What can i do? Please help me.
Get a new SIM from your carrier.
-
I already reseted my apple id password but after resetting the apple ID every time I want to login it still says your apple id is disabled. What can i do someone please help me.
Maria-2 wrote:
I already reseted my apple id password but after resetting the apple ID every time I want to login it still says your apple id is disabled.
Contact iTunes Customer Service and request assistance
Use this Link > Apple Support iTunes Store Contact
Maybe you are looking for
-
For loops and dynamic sql string syntax
Hi is there a why to loop through a dynamic sql string normally you would have FOR cur IN (select * from emp) LOOP but I have a dynamic sql string called l_sql I have tried the following FOR cur IN l_sql LOOP but I get PLS-00456: item 'L_SQL' is not
-
Updating Mobileme Gallery with iPhoto Library
I have been using my mobileme gallery to publish photos and to let my friends upload their photos as well. The problem is that when they upload their photos, I am able to see them in my Mobileme gallery, but I am not able to import them to my Library
-
User exit for pricing in Sales Order
Hi Gurus, I have a requirement while changing Sales Order and an Inquiry.Below is the requirement. I have a custom filed at the Sales Order Item level as VBAP-XXXXX. When the user changes this value to a value (say abc) then the NET value in the Cond
-
Wrong distribution key in profit center planning 7KE1
I have entered the profit center budget in Transaction 7KE1 for profit centet and account using appropriate profile and layout. The distribution key appearing is "2" however the cost distribution is as per distribution key "1" (equal distribution).
-
How to disable Alt-Left Click windowing?
So, I set up my Magic mouse to take advantage of the "highlight-paste" feature of X11 by having a gesture (click 3 fingers on the mouse) on the mouse do the Alt-Left Click to paste what I've just highlighted. This gesture is easily done on accident,