Search Results

Search found 54 results on 3 pages for 'ikurtz'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • Java MouseListener

    - by ikurtz
    I have a bunch of JLabels and i would like to trap mouse click events. at the moment i am having to use: public void mouseClicked(MouseEvent arg0) { } public void mouseExited(MouseEvent arg0) { } public void mouseEntered(MouseEvent arg0) { } public void mousePressed(MouseEvent arg0) { } public void mouseReleased(MouseEvent arg0) { System.out.println("Welcome to Java Programming!"); } I was wondering if there is a tidier way of doing this instead of having a bunch of events I do not wish trap?

    Read the article

  • Java Incompatible Types Boolean Int

    - by ikurtz
    i have the following class: public class NewGameContract { public boolean HomeNewGame = false; public boolean AwayNewGame = false; public boolean GameContract(){ if (HomeNewGame && AwayNewGame){ return true; } else { return false; } } } when i try to use it like so: if (networkConnection){ connect4GameModel.newGameContract.HomeNewGame = true; boolean status = connect4GameModel.newGameContract.GameContract(); switch (status){ case true: break; case false: break; } return; } i am getting the error: incompatible types found: boolean required: int on the following switch (status) code. what am i doing wrong please?

    Read the article

  • Java Layout Insets

    - by ikurtz
    board image the above is a board layout done by using gridbaglayout. i would like insets of 5 pixels around the whole board but not between each label. i scaned the api and havent come up with something that lets me do this. does this mean i have to nest my board gui inside another gridbaglayout with the insets desired? thank you.

    Read the article

  • Java Folder Location for Image NetBeans 6.8

    - by ikurtz
    greetings, today i have started to learn java using netbeans ide. i would like my jframe to display an icon as stated in the following: setIconImage(Toolkit.getDefaultToolkit().getImage("SartreIcon.jpg")); the questin is under netbeans ide.. exactly in which folder do i place the graphic in question in order to load it? thanks.

    Read the article

  • C# Thread Queue Synchronize

    - by ikurtz
    Greetings, I am trying to play some audio files without holding up the GUI. Below is a sample of the code: if (audio) { if (ThreadPool.QueueUserWorkItem(new WaitCallback(CoordinateProc), fireResult)) { } else { MessageBox.Show("false"); } } if (audio) { if (ThreadPool.QueueUserWorkItem(new WaitCallback(FireProc), fireResult)) { } else { MessageBox.Show("false"); } } if (audio) { if (ThreadPool.QueueUserWorkItem(new WaitCallback(HitProc), fireResult)) { } else { MessageBox.Show("false"); } } The situation is the samples are not being played in order. some play before the other and I need to fix this so the samples are played one after another in order. How do I implement this please? Thank you.

    Read the article

  • Java JFileChooser getAbsoluteFile Add File Extension

    - by ikurtz
    i have this issue working but i would like to know if there is a better way of adding the file extension? what i am doing right now is: String filePath = chooser.getSelectedFile().getAbsoluteFile() + ".html"; im adding the extension hard coded. and then saving to it. just wondering if there is a more robust/logical manner this can be implemented? thank you for your time. EDIT: i ask this as i would like my app to be portable across platforms. so adding .html manually i may make this a windows only solution.

    Read the article

  • Java JEditorPane

    - by ikurtz
    ChatGUI im using 2 JEditorPane to transfer text from one to another. once i have transfered the data i do the following: JEditorPane.setText(null); JEditorPane.setCaretPosition(0); but as you can see from the attached image the return action makes the prompt appear a row down. how can i fix this?

    Read the article

  • Java Socket Disconnect Reporting vs. C# Disconnection

    - by ikurtz
    in C# when a sockets connection is terminated the other node is informed of this before terminating the link thus the remaning node can update the connection status. in Java when i terminate a communication link the other node keeps reporting the connection as valid. do i need to implement a read cycle (makes sense) that reports the connection as lost when it recieves a -1 during read (in C# this is 0 i think)? thank you for your insight. EDIT: thanks to you both. as i suspected and mentioned in my post that an additional check is required to confirm the connected state of a connection.

    Read the article

  • Java NetBeans Comments Class Diagram Helper

    - by ikurtz
    i am starting to learn Java using Netbeans 6.8 IDE. i am wondering if there is a utility in NetBeans similar to VS2008 that facilitates commenting code and later display these comments in class diagrams? thanks. EDIT: i found the Javadoc feature. it is some help but not that great.

    Read the article

  • Java Socket Returns True

    - by ikurtz
    I hope you can help. Im fairly new to progamming and Im playing around with java Sockets. The problem is the code below. for some reason commSocket = new Socket(hostName, portNumber); is returning true even when it has not connected with the server (server not implemented yet!). Any ideas regarding this situation? For hostName Im passing my local machine IP and for port a manually selected port. public void networkConnect(String hostName, int portNumber){ try { networkConnected = false; netMessage = "Attempting Connection"; NetworkMessage networkMessage = new NetworkMessage(networkConnected, netMessage); commSocket = new Socket(hostName, portNumber); // this returns true!! System.out.println(commSocket.isConnected()); networkConnected = true; netMessage = "Connected: "; System.out.println("hellooo"); } catch (UnknownHostException e){ System.out.println(e.getMessage()); } catch (IOException e){ System.out.println(e.getMessage()); } } Many thanks. EDIT: new Socket(.., ..); is blocking isnt it? i thought in that case if that was processed without exceptions then we have a true connection?

    Read the article

  • C# Visual Studio UML Class Diagram Generator

    - by ikurtz
    I was wondering if there was a software that would generate UML class diagrams from my project files (C#) in Visual Studio 2008 Professional? Like a plugin of sorts? Thanks in advance. p.s. I have checked previous posts and did not see anything useful on the first glance. EDIT: I found Class Diagram item! but open to more tips.

    Read the article

  • Java Switch Incompatible Types Boolean Int

    - by ikurtz
    i have the following class: public class NewGameContract { public boolean HomeNewGame = false; public boolean AwayNewGame = false; public boolean GameContract(){ if (HomeNewGame && AwayNewGame){ return true; } else { return false; } } } when i try to use it like so: if (networkConnection){ connect4GameModel.newGameContract.HomeNewGame = true; boolean status = connect4GameModel.newGameContract.GameContract(); switch (status){ case true: break; case false: break; } return; } i am getting the error: incompatible types found: boolean required: int on the following switch (status) code. what am i doing wrong please?

    Read the article

  • Java JTextArea Bold

    - by ikurtz
    This is an exploratory query. I am wondering if the following is possible with JTextArea? Can I alter the text to bold (append text) and then back to normal and will it only display the bold text in bold and the rest as normal? Also can the contents of JTextArea be saved as a RTF document? Thank you.

    Read the article

  • C# TCP First Message Delay

    - by ikurtz
    greetings, i am writng a socket program using sockets in c# (asynchronous). the issue is, when a client connects to the server it kinda happens quiet fast. then.. when the first message is sent there is a delay in responding. this only happens to the very first data being sent over the connection. and boh client and server suffers from this behaviour. what is this delay? is there a way to get rid of this? many thanks.

    Read the article

  • Java Enum Newbie Question

    - by ikurtz
    i have a situation where i need the Checker enum below used in multiple classes: package Sartre.Connect4; public enum Checker { EMPTY, RED, YELLOW } so i put the Checker in a Checker.java file and then from the classes that need it i simply do the following: example: public Cell(){ currentCell = Checker.EMPTY; } example: public Cell(Checker checker){ currentCell = checker; } and the code compiles fine and runs fine also. so what is my question? well being new to Java i am just wondering if the way i use Checker without encapsulating it in a class is a sound implementation? it may be because of The enum declaration defines a class (called an enum type). as noted in Java docs enum tutorial page. thank you for your insight into this matter.

    Read the article

  • Java Version of Action Delegate invokeLater

    - by ikurtz
    the issue i mentioned in this post is actually happening because of cross threading GUI issues (i hope). could you help me with Java version of action delegate please? in C# it is done as this inline: this.Invoke(new Action(delegate() {...})); how is this achived in Java? thank you. public class processChatMessage implements Observer { public void update(Observable o, Object obj) { System.out.println("class class class" + obj.getClass()); if (obj instanceof String){ String msg = (String)obj; formatChatHeader(chatHeader.Away, msg); jlStatusBar.setText("Message Received"); // Show chat form setVisibility(); } } } processChatMessage is invoked by a separate thread triggered by receiving new data from a remote node. and i think the error is being produced as it trying to update GUI controls. do you think this is the reason? i ask because im new to Java and C#, but this is what is going on i think.

    Read the article

  • Java Object Creation Error

    - by ikurtz
    package Sartre.Connect4; import javax.swing.*; public class ChatGUI extends JDialog { public ChatGUI(){ setTitle("Chat"); } } when i do this in another class in the same package: ChatGUI chatGUI = new ChatGUI(); i end up with a situation: Cannot Find Symbol please help?

    Read the article

  • Java Serializable Object to Byte Array

    - by ikurtz
    (im new to java) from my searches for Serialization in Java most of the examples document writing to a file or reading from one. my question is lets say i have a serializable class AppMessage. I would like to transmit it as byte[] over sockets to another machine where it is rebuilt from bytes received. how could i achieve this please? thanks for your insight in advance.

    Read the article

  • Java Disabled JLabel Reports Mouse Clicked

    - by ikurtz
    colLabels[i].addMouseListener(new MyAdapter()); private class MyAdapter extends MouseAdapter { @Override public void mouseClicked(MouseEvent event) { ColJLabel colJLabel = (ColJLabel)event.getComponent(); System.out.println(colJLabel.ColID); setColumnHeader(false); } } colLabels[i].setEnabled(flag); The situation is this: Mouse clicks are trapped correctly but when i have the JLabel (ColJLabel) control disabled it still reports mouse clicks. How can I make so that mouse clicks are only reported when the control is enabled? Thanks.

    Read the article

  • Java Synchronized Write Block

    - by ikurtz
    im new to java and i have a question regarding Synchronized. i have the following code for writing to network (simple implementation for now): public void networkSendData(byte[] data){ try { out.write(data); out.flush(); } catch (IOException e) { } } i was wondering if there is a need for block level Synchronized here as im am writing the whole data at once. or is there a chance for race condition? i ask because the data to write is coming for multiple sources. thank you.

    Read the article

  • Java ServerSocketChannel SocketChannel (Callback)

    - by ikurtz
    I am trying to learn Java. I would like to implement a simple networked connect 4 game as well as a chat feature. I want my network logic to be non blocking so after much study I found that SocketChannel is what I am after regrading my needs. What has not made sense still is the lack of CallBack functions in SocketChannels.. Like one finds in C#. My query for this time is: How do I deliver the data received to the Chat or Game form (JFrame)? Some guidance is most welcome.

    Read the article

  • Java Version of Action Delegate

    - by ikurtz
    the issue i mentioned in this post is actually happening because of cross threading GUI issues (i hope). could you help me with Java version of action delegate please? in C# it is done as this inline: this.Invoke(new Action(delegate() {...})); how is this achived in Java? thank you.

    Read the article

  • Swing Menu dimensions

    - by ikurtz
    Greetings. I am trying to learn Java and Swing (today is my first day). I have been able to set up a menu in my test application. but the items occupy very little space (they are narrow). How do I go about extendng the amount of space it uses? I am studying Teach Yourself Java 6 in 21 Days 5th Ed, Java Swing, 2nd Edition, 2002 and Teach Yourself Programming With Java In 24 Hours, 4th Edition (2005) but none of them shed any light on this issue. EDIT: Menu code: JMenu _Game = new JMenu("Game"); JMenuItem _New = new JMenuItem("New"); JMenuItem _Exit = new JMenuItem("Exit"); JMenu _Turn = new JMenu("Turn"); JMenuItem _Red = new JMenuItem("Red"); JMenuItem _Yellow = new JMenuItem("Yellow"); _Turn.add(_Red); _Turn.add(_Yellow); _Game.add(_New); _Game.addSeparator(); _Game.add(_Turn); _Game.addSeparator(); _Game.add(_Exit); JMenu _Help = new JMenu("Help"); JMenuItem _About = new JMenuItem("About"); _Help.add(_About); JMenuBar _MenuBar = new JMenuBar(); _MenuBar.add(_Game); _MenuBar.add(_Help); setJMenuBar(_MenuBar); EDIT: Solved! JMenuItem _New = new JMenuItem("New "); just add spaces as needed! simple.

    Read the article

< Previous Page | 1 2 3  | Next Page >