Search:

Type: Posts; User: Bebras

Page 1 of 2 1 2

Search: Search took 0.46 seconds.

  1. Re: Broadcasting Chat Server: Socket Programming

    Well your tellEveryone methods catch block is empty. You should atleast print the stack trace, perhaps an exceltion is thrown.

    Also a tip: you should use more informative variable names.
  2. Re: Help with getting database data to a jtext field

    There are a few ways. Check this post.
  3. Re: Help with getting database data to a jtext field

    Let's start with your query.


    String sqlString = String.format("SELECT * FROM %s WHERE %s = '%s'", _tableName, TABLE_NAME);
    Why are there 3 placeholders(%s) and only 2 values given(_tableName,...
  4. Replies
    2
    Views
    271

    Re: Purpose of constructor?

    It's a place where the class does all of its initialization.

    For example:



    public class Foo {

    private int[] data;
  5. Replies
    13
    Views
    364

    Re: User interacting code within a data class

    I was doing more research on this...

    In your example, the canInteract returns a boolean. But if the user is for some reason unable to interact with the item, I need to let him know WHY. I...
  6. Replies
    3
    Views
    196

    Re: how to fill a field online?

    Well what you need to do is add POST data which wit only native libraries can be annoying. You need to write that data to an istance of HttpUrlConnection output stream which can be retrieved with...
  7. Replies
    13
    Views
    364

    Re: User interacting code within a data class

    Tell me more about your interface. What is the target type?
  8. Replies
    13
    Views
    364

    Re: User interacting code within a data class

    This approach. If I implement ItemInteraction interface inside the Item class, then nothing changes.

    If I create a separate class that implements it, I still need a large switch statement to find...
  9. Replies
    13
    Views
    364

    Re: User interacting code within a data class

    When the user clicks on an item in his inventory options are shown. These are some of the options:


    Using the item(this calls the item use method)
    Giving the item to a nearby player
    Dropping...
  10. Replies
    13
    Views
    364

    Re: User interacting code within a data class

    To give you more context, it is for a game. A player will have an array of his current items. He will be able to access his inventory, which will be a GUI list where each line represents an item....
  11. Replies
    13
    Views
    364

    Re: User interacting code within a data class

    I am aware of the MVC pattern. But I really don't see how would I implement it in this particular situation. Could give me some advice to for this situation?
  12. Replies
    6
    Views
    598

    Re: Is there a more elegant solution

    I don't know about overhead and I don't think it shoule be less of it but yes, TreeSet is always sorted and adds elements to their respective place instead of the end of the list.



    public...
  13. Replies
    13
    Views
    364

    User interacting code within a data class

    Hello,


    I have a class Item which is te superclass of many others, for example WeaponItem or WieldableItem.


    publc class Item {

    protected Map<String, DialogItemHandler> getOptions()...
  14. Re: how to detect screen size and set background to match

    You call getScreenHeight and getScreenWidth while initializing instance variables. Maybe some part of the internal android stuff isn't set up yet?

    Try using these methods somewhere in onCreate....
  15. Replies
    6
    Views
    598

    Re: Is there a more elegant solution

    If you want a sorted collection, why not use the TreeSet collection implementation?
  16. Re: how to detect screen size and set background to match

    Try



    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);

    System.out.println("Width of the window in pixels is:" +...
  17. Re: I need help with JOptionPane, JTextArea, and JScrollPane

    Well your problem is that your methods like generateReceipt print out to the defalt stream which prints out everyting to your console. Just make them return a string and use text area. For example:
    ...
  18. Thread: JNDI and EJB

    by Bebras
    Replies
    1
    Views
    319

    Re: JNDI and EJB

    Well basically it allows you to access an object via a string name.

    For example:


    InitialContext context = new InitialContext();

    context.bind("anyname", new String("hello world"));
  19. Replies
    1
    Views
    368

    Re: How to get the audio from the mic?

    Ofcourse it is posssible. There's a tutorial for capturing audio here.
  20. Replies
    22
    Views
    666

    Re: JTable custom model listener

    Well first of all, I finally got it to work. Credits to you ofcourse.

    These "strategies" you were talking about ? Can you give me an example? Now I just set the button's text to the same text as...
  21. Replies
    22
    Views
    666

    Re: JTable custom model listener

    Well but my button renderer does return "",
    @Override
    public Object getCellEditorValue() {
    return "";
    }
    Your scenario sounds great and I'm pretty sure I'll want to add more buttons with...
  22. Replies
    22
    Views
    666

    Re: JTable custom model listener

    You are right. Should I just check if it is a valid index? But somehow that doesn't sound correct. What value does it have to return for a button? Because I just return an element from the array...
  23. Replies
    22
    Views
    666

    Re: JTable custom model listener

    Okay. So I used the setModelIndex method and got an array index out of bounds exception.

    JTable has a construtor JTable(int numRows, int numColumns), so I set tthe number of colums to the size of...
  24. Replies
    22
    Views
    666

    Re: JTable custom model listener

    Yes. The text "Button clicked" is printed
  25. Replies
    22
    Views
    666

    Re: JTable custom model listener

    No. The button is still not selectable.
    JTable list = new JTable();
    list.setModel(new BanListTableModel(data,columnames));
    TableButton button = new TableButton("Atbaninti");...
Results 1 to 25 of 39
Page 1 of 2 1 2