@Curt1337: No, no one here will convert the chat server that you copied directly from Rose India to UDP so you can turn it in as a work product.
As Norm said, hire a programmer if you want someone to do your work for you.
@Curt1337: No, no one here will convert the chat server that you copied directly from Rose India to UDP so you can turn it in as a work product.
As Norm said, hire a programmer if you want someone to do your work for you.
You really should not stuff all that GUI code into your main() method, but that's another discussion altogether.
You can still get a reference to the class statically and use getResource like this
Main.class.getResource(...)
I never bothered with it myself. Perhaps it may help you get that first real job, but beyond that your working experience will be more of a factor than certs in future work. I only know one person who bothered with the JCP and that was only because he was between contracts at the time and just looking for something to do.
If you do decide you'd like to take it, don't pay some prep company a bunch of money to train you for it. There are plenty of reference and practice exams available on the net.
What Java version are you running this on?
Please clarify exactly what you are having trouble with.
If you want to pass an instance of your MyDate class as a parameter, you'll need to create it with 'new' keyword: new MyDate(...)
.
Compare your use of the Student constructor in your main() method with the constructor that you defined in the Student class. The compiler is telling you they are quite different.
So now you know that 'cnn' is null. The next step is to figure out why it's null.
MySql would need to be installed locally on their machine.
It would be much easier if you used an embedded database like H2 or JavaDB (Derby) instead.
You code needs to be in a method. You currently have it in the body of the class itself.
Look at your other programs or examples and note how they declare a main() method and put the code in there.
You can also rotate the current graphics context with the .rotate()
method of the Graphics2D class.
This part of the Java tutorial discusses these transformations.
@TheDumbestOne: Don't hijack old threads to ask vague questions. If you have something to inquire about, start a new thread and state your question more clearly.
Closing this old thread.
That is exactly what your args
parameter to the main method is for.
In the example you mentioned,"java test 2 3", args would include {2,3}.
You can simply access them by index.
int a = args[0];
Can you help me or tell me what to do? I don't want explinations because i don't UNDERSTAND ANY of it!
Please, can you just help me....
The forums are for helping you work out your programming problems. They aren't a "code on demand" service.
If you aren't willing to put any effort into it, post in the Web Development Jobs sections and pay someone to write it for you.
Take a look at the anchor property.
Edit: You'll also need to look at the weightx property. You can read about it in the general notes for the GridBagLayout class.
Unrelated to your question, but a general advice: do not do this
public class Frame extends JFrame{
JFrame itself extends java.awt.Frame
. You're just asking for confusion and possible bugs by naming your class Frame.
> PS how do you up vote a reply, i can only see how to close the question
Each post has a pair of arrows on the right side. These allow you to up or down vote the post and optionally leave a reputation comment.
You could also use something like this example with a JList: http://www.java2s.com/Code/Java/Swing-Components/TableRowHeaderExample.htm
Just add the data to your table model. If you want to render it differently, you can create a custom table cell renderer for that.
Have you tried just specifying "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel"?
You're going to need to increment y and repaint() at some point.
The easiest way is to use a label with the icon. Here's a tutorial on that: http://download.oracle.com/javase/tutorial/uiswing/components/icon.html
You still didn't post the errors.
That's your assignment, not a specific question. What are you having trouble with specifically? If you're receiving errors, post the stack traces.
Perhaps no one has any useful recommendations for you?
I found this with a quick search, but I don't know a thing about it.
It's a rather esoteric request that you've made, so you can't necessarily assume that people are simply ignoring your post. Most probably just don't have the information you're seeking.
A few possibilities:
You could extend JLabel to maintain a reference to the object, in which case the listener could retrieve it directly from the clicked label.
You could create a listener that keeps a reference to the object and create a new instance for each JLabel.
You could use a Map to store the label to object mappings.
I don't see where you specify the table name anywhere in that function, just the column.
First, I would recommend fixing your indentation in the posted code fragment. People are more willing to read well-formatted code.
Second, I would check the procedure itself. Sounds like it's unhappy about an aggregate function or group clause.
I told you explicitly: update "previousX" in your listener.
> If it is only a handful of times, what does it hurt having it and not using it?
Because any extra feature/button adds an element of confusion (& frustration) for everyone who doesn't know what it is or how to use it.
Tooltips can go a long way towards mitigating that confusion.
You can use any means you wish to load and save the elements with a DefaultListModel. You aren't limited to an array for that.
I don't think you want to just group by last name though. Different families could have the same last name. I would stick to family id.
Nah. I have other more pressing things to work on.
Perhaps you should give it a try yourself. When you have some code or specific questions about the parts you are stuck on, come back and post them and perhaps someone can offer some assistance.
> 99% of "SEO spammers" are people who would really make excellent contributing members of our community
I would say closer to 5% at best. The other 95% are blathering idiots that only sign up to parrot useless "advice" they copied from a poster above or some article farm content in an effort to spread their signatures around.
If they actually want to learn and have productive discussions about SEO and internet marketing then they should be willing to do it without any signatures. Turn off signatures completely for a month and see what happens. Just consider it an experiment.
Ok, I would say your thread is the problem. It will repaint just like you want it to - once. There is no loop. You get one repaint and you're done.
You could either add a loop with a sleep() in it or switch to a Swing Timer and put your current run() code into an ActionListener.
The get() method will return an element by index from a Vector.
I'd recommend using ArrayList instead of Vector unless you need a synchronized collection (and I doubt that you do). The get() method is still the same.
You might also consider using Point objects instead of keeping separate lists for the x and y values.
And where are you initializing your jTable2 instance?
Edit: cross-post. I knew you would see it eventually :)
The statement you added would work, though I would imagine it's giving you fits about a null pointer. You can't assign a model to a table you haven't created yet.
Yes, the trouble is in your constructor. You declare a variable 'tableModel', initialize it, and add a listener to it - and then you don't do anything with it. It goes out of scope.
Your JTable is still using whatever default model it had in initComponents(). If you want to use the 'tableModel' you created, you can use the JTable.setModel();
method or pass that model to the JTable constructor when you create the table.
I don't think the OP is still working on this 2 years later. Closing.
You should ask for a refund.
Then you will need to loop the cells and find it before you can select it.
Ah, yes, selection is different. You can use the methods on JTable to select both the row and column setRowSelectionInterval(int index0, int index1) and
setColumnSelectionInterval(int index0, int index1).
You'll still need the highlight renderer if you want to make a cell red.
There is not a row renderer per se, so you have to install a cell renderer on all columns that will check the particular column values and apply the formatting as necessary.
Here is a skeletal highlight renderer to give you an idea to work from
class HighlightRenderer extends DefaultTableCellRenderer {
private final Color HIGHLIGHT_COLOR = Color.YELLOW;
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
Component comp = super.getTableCellRendererComponent(table, value, isSelected,
hasFocus, row, column);
if ( [highlight condition] ) {
if (isSelected) {
comp.setBackground(new Color((HIGHLIGHT_COLOR.getRGB()
^ comp.getBackground().getRGB())));
comp.setForeground(new Color(Color.BLACK.getRGB()
^ comp.getForeground().getRGB()));
} else {
comp.setBackground(HIGHLIGHT_COLOR);
comp.setForeground(Color.BLACK);
}
} else {
if (isSelected) {
} else {
comp.setBackground(Color.WHITE);
comp.setForeground(Color.BLACK);
}
}
return comp;
}
}
You can install the renderer directly on the columns
TableColumnModel colModel = table.getColumnModel();
for (Enumeration<TableColumn> colEnum = colModel.getColumns(); colEnum.hasMoreElements();) {
TableColumn c = colEnum.nextElement();
c.setCellRenderer(new HighlightRenderer());
}
or override getCellRenderer() on the JTable as noted in the JTable tutorial here.
You can try replaceAll("<.+?\\>", "")
The problem is that the GridLayout sizes each grid cell the same, so when you increased the height of your textfield by changing the font size, you increased the height of all rows in the grid.
To get around that you could use a BorderLayout of two panels, one with your text field at the top and another for all of your other buttons in the center.
That would allow you to separate the sizing of the two sections. Take a glance at this change to your layout code
//Setting the layout
JPanel upper = new JPanel();
upper.setLayout(new GridLayout(1,1));
upper.add(jtfTxt);
JPanel lower = new JPanel();
lower.setLayout(new GridLayout (13, 1, 2, 2) );
lower.add(p1);
lower.add(p2);
lower.add(p3);
lower.add(p4);
lower.add(p12);
lower.add(p5);
lower.add(p11);
lower.add(p6);
lower.add(p7);
lower.add(p8);
lower.add(p9);
lower.add(p10);
f.setLayout(new BorderLayout());
f.add(upper, BorderLayout.NORTH);
f.add(lower,BorderLayout.CENTER);
f.setJMenuBar(mb);
f.setResizable(false);
f.setBackground(Color.black);
f.pack();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);