evenmu's Profile User Rating: -----

Reputation: 0 Apprentice
New Members
Active Posts:
10 (0.01 per day)
30-August 12
Profile Views:
Last Active:
User is offline Oct 02 2012 02:47 PM

Previous Fields

Dream Kudos:
Icon   evenmu has not set their status

Posts I've Made

  1. In Topic: Frame for each player (Card Game)

    Posted 21 Sep 2012

    View PostGregBrannon, on 21 September 2012 - 12:02 PM, said:


    but this method maks a new JFrame, and it alsow will make a new deck in each frame, like in the pictures.

    I don't really see where the new deck is being created for each new JFrame, but that's probably because I don't know Norwegian. In any case, it seems the solution is to create JFrames without a new deck for each. Create all 4 JFrames, perhaps in an array as suggested, and then a single deck of cards.

    What's the problem?

    Here is my full code.


    Then you can se how i build up my code.
  2. In Topic: Frame for each player (Card Game)

    Posted 21 Sep 2012

    I can just show you.
    Here is some screen shots.
    Just a heads up, the program is in Norwegian.


    You can se that the cards in each frame in picture number 3, have a different card on the table. And some cards are the same.

    View Postpbl, on 21 September 2012 - 10:51 AM, said:

    View Postevenmu, on 21 September 2012 - 12:21 PM, said:


    So how can i crate multipel frames from the same deck(ArrayList)

    Yes, nothing stop you from creating an array of JFrame
    you'll just have to put in a loop
    - = new JFrame
    - set position
    - set visible

    but this method maks a new JFrame, and it alsow will make a new deck in each frame, like in the pictures.
  3. In Topic: A simple card game project - Object into List

    Posted 6 Sep 2012

    View PostCasiOo, on 06 September 2012 - 12:35 PM, said:

    I don't know why you want to print out one of the values, but you could just use your get methods.
    What does this have to do with adding to the list? Please try and explain your problem in a different way :)

    Kort card = new Kort(Kort.Kortfarge.KLOVER, 2);

    I figurd it out :bigsmile:

    My problem was that when I created the rulse. I need to do a bunch of testing,
    and when i test the cards against each other i just need one of the parameters value from the Object.
    I solved this problem like this.

  4. In Topic: A simple card game project - Object into List

    Posted 6 Sep 2012

    View Postmacosxnerd101, on 06 September 2012 - 07:14 AM, said:

    There are some problems with your code. First, you can't pass card(2, 4) to the List add() method since card() is a variable, not a method. You would pass 2 and 4 to the constructor.

    With list.get(), you would pass an index to get(). That would return a Card object. You can then invoke methods on the Card class to do what you need to do.

    No..that was just an example.

    If you se, the object Kort have two parameters. I want just to print out one of the parameters after adding it in a ArrayList.

    Here is my two classes. The method and the variables are in Norwegian.

    This is my Card class

    package kortstokk;
    public class Kort {
    	public enum Kortfarge {KLOVER, HJERTER, RUTER, SPAR};
    	private int verdi;
    	private Kortfarge farge;
    	public Kort(){
    	public Kort(Kortfarge farge, int verdi ){
    		this.farge = farge;
    		if(verdi < 1 || verdi > 13) throw
    		new IllegalArgumentException("Kort må ha verdi mellom 1(ess) og  13(kong)");
    			this.verdi = verdi;
    	public int getVerdi() {
    		return verdi;
    	public Kortfarge getFarge() {
    		return farge;
    	public static String fargeString(Kortfarge farge){
    		if(farge == Kortfarge.KLOVER)  return ("Kløver");
    		if(farge == Kortfarge.RUTER)   return ("Ruter");
    		if(farge == Kortfarge.HJERTER) return ("Hjerter");
    		if(farge == Kortfarge.SPAR)    return ("Spar");
    		return "Feil";
    	public static String verdiString(int verdi){
    		if(verdi == 1) return ("Ess");
    		if(verdi == 11) return ("Knekt");
    		if(verdi == 12) return ("Dame");
    		if(verdi == 13) return ("Koeng");
    		if(verdi > 13 || verdi < 1) return ("Feil");
    		return Integer.toString(verdi);
    	public String toString(){
    		return fargeString(farge) + " " + verdiString(verdi);

    This is my Deck Class

    package kortstokk;
    import java.util.ArrayList;
    import java.util.Collections;
    public class Kortstokk {
    		ArrayList<Kort> list;
    	public Kortstokk(){
    		list = new ArrayList<Kort>();
    	public void fullKortStokk(){
    		for(int i=1; i < 14; i++){
    			list.add(new Kort(Kort.Kortfarge.HJERTER, i));
    			list.add(new Kort(Kort.Kortfarge.RUTER, i));
    			list.add(new Kort(Kort.Kortfarge.SPAR, i));
    			list.add(new Kort(Kort.Kortfarge.KLOVER, i));
    	public void stokk(){
    	public Kort trekk(){
    		Kort trekk = list.get(list.size()-1);
    		return trekk;
    	public void leggTil(Kort nyttKort){
    	public int antallKortIgjen(){
    		return list.size();
    	public Kort overstKort(){
    		return list.get(list.size());
    	public boolean erTom(){
    		return list.isEmpty();
    	public void fjernKort(int index){
  5. In Topic: A simple card game project - Object into List

    Posted 6 Sep 2012

    I am done with the classes: Card and Deck.
    I have added the cards(made a Card object in the Deck class) to an ArrayList.
    Now i want to make the game. fist sep is to make the card game rules.

    But my problem is that the Card object that was added to the Array, have to parameters.
    How can i get the data from just one of the parameters?

    I need just one paramenter because it would be esaier to make the rule methods.


     ArrayList<Card> list = new ArrayList<Card>();
     Card card = new Card(cardType , value)
    //How can i print out just one of the parameters from the ArrayList ?
         System.out.println(list.get(i just want one of the parameters??);

My Information

Member Title:
New D.I.C Head
Age Unknown
Birthday Unknown

Contact Information



evenmu hasn't added any friends yet.


evenmu has no profile comments yet. Why not say hello?