|
@Richard
You know, I thought of that and that would be the easiest way out. I was hoping there was a way to keep the loop going, but, I guess I was in denial! lol Thanks for your help!
|
|
|
|
|
I'm not sure (obviously) how the whole app fits together, but this would be the 'normal' way of doing things.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I totally agree! I let myself get hung up on not breaking the loop. Bad input should break the loop, since proper input is mandatory.
I've pretty much just started learning java on my own, but had taken a C# course last semester, so I have a little bit of a leg up on it.
For a linux class project, I'm going to make an IPV4 subnet calculator using the linux Netbeans IDE. So, I thought I'd make a simple GUI program in Netbeans to figure out the GUI mechanics.
The program this code is from is a drastically simple calculator that adds two floats (if valid) and displays the result in a third textbox.
Now, its just a matter of figuring out how to get mnemonics and keybinds to work for the Add, Clear and Exit buttons. The Netbeans IDE isn't all that clear on how to do that, so the digging for information continues
Thanks for your time on this rather simple fix!
|
|
|
|
|
LEKnowlton wrote: The Netbeans IDE isn't all that clear
Sometimes the only way to this information is to use the tutorials[^] and the API documentation[^].
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
From what I've gleaned from searches on this:
I'm thinking that instead of strictly using the mouse click event for each button that I can use the actionevent listener and set up a case logic structure to choose which action does what.
|
|
|
|
|
Yes, that's the way to go.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Someone down voted this question for no reason that I can see, so I added a +5 in compensation.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi all, I'm a relative novice at Programming. I can't figure out if I am doing this right? I am required to correct the syntactic and semantic errors in the following program:
{
public static void main(String[] args){
int x,t;
double k;
x = 56;
k = 7;
x = 6 + k;
k = x*3.5 + 5
t = t + x;
System.out.println(x);
System.out.println(k);
System.out.println(t);
}
}
This is my attempt:
{
public static void main(String[] args){
int t;
double x,k,temp1,temp2;
x = 56;
k = 7;
temp1 = x;
x = 6+k;
temp2 = k;
k = x*3.5+5;
System.out.println(x);
System.out.println(k);
}
}
Not really sure what I'm doing, would appreciate help. Thanks in advance all.
|
|
|
|
|
Did you read #11 of the guidelines above? Your question smells of homework.
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
it is kind of - seems like one of the java certificate questions.
regards Torsten
I never finish anyth...
|
|
|
|
|
You're completely wrong - it's much simpler. You should not rewrite the code - just check out the errors.
Hint:
Take a look at the variable "t" and check the line 7 of the given code.
regards Torsten
I never finish anyth...
|
|
|
|
|
Instead of giving him a hint, why don't you direct him to Syntatic and Semantic error's explanation[^]?
Oxfords English < Official CCC Players Dictionary
Excuse me for my improper grammar and typos.
It's because English is my primary language, not my first language.
My first languages are C# and Java.
VB, ASP, JS, PHP and SQL are my second language.
Indonesian came as my third language.
My fourth language? I'm still creating it, I'll let you know when it's done!
|
|
|
|
|
because I didn't want to tell him that direct what he's about to find.
regards Torsten
I never finish anyth...
|
|
|
|
|
I'm doing about File Explorer which similar to Windows Explorer in Windows .
I don't know why Windows Explorer get "Extract here , Extract File" ... which have when install Winrar .
I want popup menu at forder to do it .
Any idea ??
sorry about my english !! .
|
|
|
|
|
write the functionality yourself. You don't need tools like winrar for this.
this is how you can do it[^]
regards Torsten
I never finish anyth...
|
|
|
|
|
I don't think that's what he's asking.
I think his question is something like: I want to display a pop-up menu which will give the user a list of actions associated with a file type. For example, if the file is a RAR file, I want to display the options associated with Winrar. Think Windows Explorer, you right-click on a file and up pops a menu telling you what you can do with that file.
I'm not sure how you do this from Java since finding the list of actions for a specific file type is OS-specific, and that is always where Java's "run anywhere" approach struggles. The Desktop API gives you some access to this, but it has a limited set of pre-defined actions available and I'm not sure how you add in other actions like zip or unzip (or even if you can).
There was a project on the go at one time called JDIC which aimed to make OS-specific desktop integration a bit easier, but I haven't heard about that for a while. It was basically a series of wrappers around native calls for the main operating systems like Windows and Linux. It might be worth a look, though, if it is still around.
|
|
|
|
|
Is this needed any more? compressed folder/files are nowadays opened by the file explorers.
Other extensions should be thrown against the OS to open/execute it - you'll get the "don't know how" dialog if the file extension is not known.
regards Torsten
I never finish anyth...
|
|
|
|
|
I think the whole zip file, Winrar thing was just an example from the OP. If I read his post correctly, he's trying to build a Windows Explorer clone, that's his main interest here. The whole issue of how to compress or uncompress files is a bit of a red herring. It's more of a general question about file types and actions.
The Java Desktop class allows you to Open, Print, Edit files with a bit more control than simply shelling out and trying to run the file. For example, you can test whether or not there is an Edit action associated with a file type as distinct from Open (think of *.cmd files on Windows: Open and Edit do different things). What it doesn't let you do is access non-standard options that other programs like Winrar may associate with specific file types like *.zip or *.rar, for example Extract Here as opposed to Extract.
The NetBeans Platform includes an API that allows you to associate arbitrary actions with file types, but it is up to you (the programmer) to create the association, it is not derived from the underlying operating system.
|
|
|
|
|
Thank you . Great answer . .
|
|
|
|
|
hi,
i want code for image processing in java
i am already working on this part with matlab just i want help som code in matlab thus i unable to post that code
|
|
|
|
|
This is really not a question that can be answered in a forum such as this. We have no idea what code you are talking about (I wonder do you) and even then this forum is not here to provide solutions on demand. Make an effort to research your problem for yourself and come back here when you have a more specific question.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi all, here's a kinda bullet-pointy explanation of what i have
- I have a simple JFrame
- I create a JPanel called 'ContentPane'
contentPane = new JPanel();
contentPane.setBackground(SystemColor.window);
contentPane.setBorder(new LineBorder(SystemColor.inactiveCaption));
contentPane.setLayout(null);
setContentPane(contentPane);
- the JFrame has a
JMenuBar -> JMenuBar -> JMenuItem
- The JMenuItem has a MouseListener and a override to 'mouseReleased'
- Inside mouseReleased i call
TestPanel p = new TestPanel(null, new Vector2(12, 12));
contentPane.add(p);
- TestPanel extends a JPanel, and ha some simple text boxes and labels in it which are created in its constructor, super(); is called.
- When the event is fired it creates a TestPanel but it is tiny, about an inch long and 5 mm in height, it should be much much bigger.
- If I move the call to instance the TestPanel outside of the event (so the TestPanel is instanced on load) it is drawn fine.
Why does the event effect it in this way ?
Thanks,
Stu.
|
|
|
|
|
Without seeing what your TestPanel constructor actually does, it's difficult to guess.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
super();
this.setBounds((int) position.getX(), (int) position.getY(), 760, 92);
this.setTransferHandler(new FileDropHandler());
this.setBorder(new LineBorder(SystemColor.activeCaption));
this.setBackground(new Color(240, 248, 255));
this.setVisible(true);
JLabel lblComputerMonitor = new JLabel("");
lblComputerMonitor.setBounds(12, 4, 64, 88);
lblComputerMonitor.setIcon(new ImageIcon(Main.class.getResource("/Resources/monitor_64.png")));
JLabel lblCustomName_Static = new JLabel("Custom Name:");
lblCustomName_Static.setBounds(82, 4, 91, 27);
lblCustomName_Static.setFont(new Font("Segoe UI", Font.PLAIN, 12));
JLabel lblCustomName = new JLabel("Some guy");
lblCustomName.setBounds(183, 4, 152, 27);
lblCustomName.setFont(new Font("Segoe UI", Font.PLAIN, 12));
JLabel lblNewLabel = new JLabel("Disconnect");
lblNewLabel.setBounds(674, 5, 78, 27);
JLabel lblNetworkName_Static = new JLabel("Network Name:");
lblNetworkName_Static.setBounds(82, 31, 91, 26);
lblNetworkName_Static.setFont(new Font("Segoe UI", Font.PLAIN, 12));
JLabel lblNetworkName = new JLabel("Stuarts-pc");
lblNetworkName.setBounds(183, 31, 152, 26);
lblNetworkName.setFont(new Font("Segoe UI", Font.PLAIN, 12));
JLabel lblGroups = new JLabel("Groups");
lblGroups.setBounds(652, 43, 100, 34);
lblGroups.setHorizontalAlignment(SwingConstants.LEFT);
lblGroups.setIcon(new ImageIcon(Main.class.getResource("/Resources/Users2.png")));
lblGroups.setOpaque(true);
lblGroups.setBackground(new Color(255, 245, 238));
lblGroups.setBorder(new LineBorder(new Color(255, 218, 185)));
JPopupMenu popupMenu = new JPopupMenu();
addPopup(lblGroups, popupMenu);
JCheckBoxMenuItem chckbxmntmTest = new JCheckBoxMenuItem("Test");
popupMenu.add(chckbxmntmTest);
JCheckBoxMenuItem chckbxmntmTest_1 = new JCheckBoxMenuItem("Test2");
popupMenu.add(chckbxmntmTest_1);
JLabel lblNetworkIP_Static = new JLabel("Network IP:");
lblNetworkIP_Static.setBounds(82, 60, 91, 26);
lblNetworkIP_Static.setFont(new Font("Segoe UI", Font.PLAIN, 12));
JLabel lblNetworkIP = new JLabel("192.168.0.2");
lblNetworkIP.setBounds(183, 60, 152, 26);
lblNetworkIP.setFont(new Font("Segoe UI", Font.PLAIN, 12));
this.setLayout(null);
this.add(lblComputerMonitor);
this.add(lblNetworkIP_Static);
this.add(lblNetworkName_Static);
this.add(lblCustomName_Static);
this.add(lblNetworkIP);
this.add(lblNetworkName);
this.add(lblCustomName);
this.add(lblNewLabel);
this.add(lblGroups);
|
|
|
|
|
- give Testpanel a size
- let ContentPane repaint when the event is fired
But you say the panel is there... Are there other parts of your GUI defined which compress the visual parts of your Testpanel?
regards Torsten
I never finish anyth...
|
|
|
|
|