CasiOo's Profile User Rating: *****

Reputation: 1275 Grandmaster
Group:
Expert
Active Posts:
2,833 (2.55 per day)
Joined:
05-April 11
Profile Views:
10,830
Last Active:
User is offline Yesterday, 07:45 PM
Currently:
Offline

Previous Fields

Country:
DK
OS Preference:
Who Cares
Favorite Browser:
Opera
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
225
Expert In:
Java

Latest Visitors

Icon   CasiOo has not set their status

Posts I've Made

  1. In Topic: Problems with JFrame + Web page

    Posted 16 Apr 2014

    The JEditorPane found in Swing does not support any of the new styles or html tags
    I would advice you to not use the component for showing online webpages at all ^^

    Maybe you'll be able to find a library which adds a more up to date webview. JavaFX might have one :)
  2. In Topic: Layout Help

    Posted 14 Apr 2014

    You need to explain how the tileset and tilesetting panels should be displayed
    Is tilesetting having a predefined height, or should the two take up equal height?
    You could also make it possible for the user to resize the panels to their preferred size :)

    An easy way to get your preferred layout is by using BorderLayout all the way (for now) ^^
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    
    
    public class TileMapCreator extends JFrame {
    
    	public static void main(String[] args) {
    		SwingUtilities.invokeLater(TileMapCreator::new); 
    	}
    
    	public TileMapCreator() {
    		constructLayout();
    		setDefaultCloseOperation(EXIT_ON_CLOSE);
    		setSize(800, 600);
    		setVisible(true);
    	}
    	
    	private void constructLayout() {
    		add(createMapView(), BorderLayout.CENTER);
    		add(createSetSettingsViews(), BorderLayout.EAST);
    	}
    	
    	private JComponent createMapView() {
    		JPanel mapPanel = new JPanel();
    		mapPanel.setBackground(Color.RED);
    		return mapPanel;
    	}
    	
    	private JComponent createSetSettingsViews() {
    		JPanel container = new JPanel(new BorderLayout());
    		container.add(createTileSetView(), BorderLayout.CENTER);
    		container.add(createTileSettingsView(), BorderLayout.SOUTH);
    		return container;
    	}
    	
    	private JComponent createTileSetView() {
    		JPanel setPanel = new JPanel();
    		setPanel.setBackground(Color.GREEN);
    		return setPanel;
    	}
    	
    	private JComponent createTileSettingsView() {
    		JPanel settingsPanel = new JPanel();
    		//Setup a preferred size just for the demo
    		settingsPanel.setPreferredSize(new Dimension(200, 200));
    		settingsPanel.setBackground(Color.YELLOW);
    		return settingsPanel;
    	}
    }
    
    
    
  3. In Topic: java text adventure game-nullpointerexception

    Posted 14 Apr 2014

    Your name and dialog variables are static, which means they are being shared between all instances of the class
    Static variables are also referred to as class variables, because they belong to the class and not the instance

    There is no reason to have static name and dialog
  4. In Topic: In regards to reading variables and their values from files

    Posted 14 Apr 2014

    So the part you are having trouble parsing is this?

    Quote

    a = 5
    b = 10
    c = 20
    ( x + y ) * z
    x = 13
    y = 21
    z = 3


    For basic parsing without much error checking, you would simply split on every "=" symbol found in the line
    Next you would take/parse the left and right side separately
    Something like
    private VariablePair readVariableValuePair() {
    	String[] tokens = scanner.nextLine().trim().split('=');
    	
    	if (tokens.length == 2) {
    		char variable = tokens[0].trim().charAt(0);
    		int value = Integer.parseInt(tokens[1].trim());
    		return new VariablePair(variable, value);
    	}
    	else {
    		throw new ParseException("Line was not a key-value pair!");
    	}
    }
    
    

    You would need to add more validation to the above method though
  5. In Topic: Guessing Game GUI

    Posted 14 Apr 2014

    You would typically change the visibility of your components instead of adding/removing them on the fly
    It saves you much of the layout trouble

    When you evaluate the answer to be correct, you are still executing the rest of the method
    Maybe you first turn it green, but before of the code following, it turns out red?

My Information

Member Title:
D.I.C Lover
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
3

Contact Information

E-mail:
Private

Comments

Page 1 of 1
  1. Photo

    riperator Icon

    31 Jul 2013 - 10:33
    <3 you
  2. Photo

    b.netana Icon

    23 Mar 2013 - 17:32
    thank*
  3. Photo

    b.netana Icon

    23 Mar 2013 - 17:32
    wanted to that you for your help with my gui practice
  4. Photo

    raghav.naganathan Icon

    25 Nov 2012 - 21:15
    Hi dude...I would like to tell you that your rep(729) is a perfect cube :) Cheers :)
  5. Photo

    ubunta Icon

    30 Sep 2012 - 23:33
    hi hello
    hope will be fine and feeling well!!!!!!!!!!!!!!
  6. Photo

    Proshnobodhok Icon

    12 Oct 2011 - 12:31
    Hi CasiOo,
    I really didnt know the term. nyways seems like you can help me in at least telling me the way to get the related resources. but is it against the IT laws?
  7. Photo

    CasiOo Icon

    28 Jun 2011 - 04:11
    Thank you :)
  8. Photo

    smohd Icon

    26 Jun 2011 - 19:39
    Welcome to contributors group
Page 1 of 1