• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX:JTextField squeeze into funny size -- help!!

 
Zhi Gang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there i have been using JPanel for my create new record screen. I have tested it with different pc. some of the pc work fine, and few pc have squeeze the JTextField to a funny size,
i think might be the display card in the those pc.
if i pretend is ok and submit it. what-if the examiner have a old display card
or
maybe all the sun examiner are loaded should have up to date display card or ....
i am really run out of ideas.. please let me know what u think.. thanks
=========
JPanel namePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
namePanel.setPreferredSize(new Dimension(758, 35));
namePanel.add(new JLabel("Subcontractor Name : "));
newName.setDocument(new LimitedDocument(MAX_NAME));
namePanel.add(newName);
JPanel locPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
locPanel.setPreferredSize(new Dimension(758, 35));
locPanel.add(new JLabel(
"City : "));
newLoc.setDocument(new LimitedDocument(MAX_LOCATION));
locPanel.add(newLoc);
JPanel jobPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
jobPanel.setPreferredSize(new Dimension(758, 35));
jobPanel.add(new JLabel("Type of work performed : "));
newSpecialties.setDocument(new LimitedDocument(MAX_SPECALTIES));
jobPanel.add(newSpecialties);
JPanel sizePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
sizePanel.setPreferredSize(new Dimension(758, 35));
sizePanel.add(new JLabel("No. of staff in organization : "));
newSize.setDocument(new LimitedDocument(MAX_SIZE));
sizePanel.add(newSize);
JPanel ratePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
ratePanel.setPreferredSize(new Dimension(758, 35));
ratePanel.add(new JLabel("Hourly charge : "));
newRate.setDocument(new LimitedDocument(MAX_RATE));
ratePanel.add(newRate);
JPanel submitPanel = new JPanel(new FlowLayout(FlowLayout.
CENTER));
submitPanel.setPreferredSize(new Dimension(758, 35));
submitPanel.add(clearButton);
submitPanel.add(submitButton);
JPanel infoPanel = new JPanel(new FlowLayout(FlowLayout.
CENTER));
infoPanel.setPreferredSize(new Dimension(758, 35));
newRecNo.setForeground(Color.red);
infoPanel.add(newRecNo);
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zhi, which new assignment do you have? As I am unaware of all the versions and requirements I could be wrong. But does your assignment require you to make a create record entry screen?
What Layout Manager are you using? What is your JPanel's minSize? What happens when you resize your screen to be bigger, do you see more of your JTextField? What is the column size of your JTextField?
Check out Sun's tutorial on Swing and Layout Manager's. They determine how components are layed out on the screen. I wish I had the link, but I don't have it right now, but just go to Sun's Java site and look for the tutorial trails.
Mark
 
Zhi Gang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there, iam doing the Contractor V2.1.2 this is the instraction that i have from the db interface.
i just assume that they need a create functional
--------------------------------------------------
// Creates a new record in the database (possibly reusing a
// deleted entry). Inserts the given data, and returns the record
// number of the new record.
public int create(String[] data) throws DuplicateKeyException;
--------------------------------------------------
i have created a JTabbedPanel which consists of JPanel:-
main - the jtable,update,delete, search
create - just for create
1. am i got a wrong version?
please let me know if u have any ideas ...
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Zhi
I havent seen the instructions for Contractors, however I advise you to check your instructions. Neither hotel nor airline assignments required client side implementation of the add record functionality.
In Hotel, you are required to implement the create() and delete() interfaces in the database / server. So some other application can then use this method to create records.
However in hotel and airline, the client application only needs to modify existing records.
Check whether you need to implement the create() in the client GUI.
Regards, Andrew
 
Zhi Gang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the only information that in the instructions
=================================================
The User Interface
The user interface for this assignment must satisfy the following criteria:
It must be composed exclusively with components from the Java Foundation Classes (Swing components).
It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.
It must present search results in a JTable.
It must allow the user to book a selected record, updating the database file accordingly.
Your user interface should be designed with the expectation of future functionality enhancements, and it should establish a framework that will support this with minimal disruption to the users when this occurs.
==================================================
the sentances with updating the database file accordingly.. i thought create a new record is updating database as well, isn't?
however i didn't see any information that restrict the client doing updating ...
i really confuse.
please let me know what you think
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Zhi
It must allow the user to book a selected record, updating the database file accordingly.

I would read this as "the client must be able to update the record they selected".
You cannot select a record to create it, therefore you do not need to have create functionality.
You are creating extra work for yourself by taking part of the sentence out of context. In the complete sentence it only requires you to do an "update" on an existing record. No need to do a create or delete.
And doing extra work will not get you extra marks, and may cause you to loose marks.
Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic