Search:

Type: Posts; User: Bebras

Page 1 of 2 1 2

Search: Search took 0.17 seconds.

  1. 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...
  2. 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....
  3. 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?
  4. Replies
    6
    Views
    92

    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...
  5. 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()...
  6. 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....
  7. Replies
    6
    Views
    92

    Re: Is there a more elegant solution

    If you want a sorted collection, why not use the TreeSet collection implementation?
  8. 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:" +...
  9. 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:
    ...
  10. Thread: JNDI and EJB

    by Bebras
    Replies
    1
    Views
    195

    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"));
  11. Replies
    1
    Views
    276

    Re: How to get the audio from the mic?

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

    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...
  13. Replies
    22
    Views
    622

    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...
  14. Replies
    22
    Views
    622

    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...
  15. Replies
    22
    Views
    622

    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...
  16. Replies
    22
    Views
    622

    Re: JTable custom model listener

    Yes. The text "Button clicked" is printed
  17. Replies
    22
    Views
    622

    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");...
  18. Replies
    22
    Views
    622

    Re: JTable custom model listener

    2610
    Just to be sure.
  19. Replies
    22
    Views
    622

    Re: JTable custom model listener

    Yes that is right. Why do you say "conceptually"? How it isn't correct?
  20. Replies
    22
    Views
    622

    Re: JTable custom model listener

    new problem!
    I also wanted to add a button as a cell, so I created a "TableButton" class which extends JButton and implements TableCellEditor AND TableCellRenderer.
    All is great except that I want...
  21. Replies
    22
    Views
    622

    JTable custom model listener

    Hello, I created a default JTable and added a listener to it. Everything worked great. But the default model wasn't good enought, so I created my own. And once I change data nothing happens.

    My...
  22. [SOLVED] Custom listener: how to separate interactors

    Hello, my application shows a profile. The profile has various interactors. I'm trying to follow the MVC model, so I neeed to tell my controller that something was selected. But the profile has many...
  23. Replies
    4
    Views
    489

    [SOLVED] Re: Image not loading

    Now I feel stupid... Ofcourse thankyou.
    But it seems the URL is different for different skins...
    So I'll have to load images from my pc. But this is an applet... Could you give me some info on how...
  24. Replies
    4
    Views
    489

    [SOLVED] Re: Image not loading

    No errors. And you were wrong, I didn't figure it out.


    import java.awt.Graphics2D;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    import java.net.URL;

    import...
  25. Replies
    4
    Views
    489

    [SOLVED] Image not loading

    Hello, I'm trying to load an image and display it as JLabels ImageIcon.
    This is from a method which loads it(the url is just fine)


    try {
    URL url = new...
Results 1 to 25 of 31
Page 1 of 2 1 2