Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Discussions about how to get started building a site are fine here, but soliciting work for hire must stay in the Business Exchange section. Any more offers like this and the thread will be closed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You should start typing - that's where source code comes from. Post actual questions when you have specific troubles.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I understand you can't please everyone, however it's also worth considering 648,000 of the users you mentioned probably have less than 3 posts each, while the bulk of the answers to questions here come from less than 100 members - the vocal ones.

Many of us had to adjust our ways considerably with the last rounds of major changes. Having settled into new habits, it's frustrating to see a useful feature that we've settled into taken away.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, I guess the regular users who have posted asking what happened to it and wanting it to be returned were not at that conference. I've seen 8 posts on it since it disappeared yesterday.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Might want to check that...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Cast your Graphics reference to Graphics2D and turn on anti-aliasing:

Graphics2D g2D = (Graphics2D)g;
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
kolibrizas commented: That really solves my issue! +1
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Those are actually unrelated to the painting example. That code just makes sure that the GUI initialization occurs on the event dispatch thread. You can read more about that here if you are curious:
http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html

Stefano Mtangoo commented: Great piece of code, good explanations! +4
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're adding your components to the frame content pane itself - not the JPanel that you're constructing. So you end up with an empty panel plus your splitpane. You just need alter two lines to fix that

frame = iframe;
        // you want to set the panel layout and pass it as ref instead of 'container'
        [B]setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));[/B]
        splitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
        splitPane1.setPreferredSize(new Dimension(1100, 800));
        splitPane1.setOneTouchExpandable(true);
        splitPane1.setDividerLocation(0.9);
        splitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
        splitPane2.setOneTouchExpandable(true);
        splitPane2.setDividerLocation(0.5);
        font = new Font("Monospaced", Font.BOLD, 14);

        Panel2 = new JPanel();
        Panel2.setBackground(Color.white);
        Panel3 = new JPanel();
        Panel3.setBackground(Color.white);
        Panel1 = new JPanel();
        Panel1.setBackground(Color.white);

        splitPane1.setResizeWeight(0.9);
        splitPane2.setResizeWeight(0.5);

        splitPane1.add(splitPane2);
        splitPane1.add(Panel2);
        splitPane2.add(Panel3);
        splitPane2.add(Panel1);
        splitPane1.setVisible(true);
        splitPane2.setVisible(true);
        // add to panel - not 'container'
        [B]add(splitPane1);[/B]

edit: I really don't see any use for the "container" parameter at all. It's redundant with the frame reference and depending on what else you plan to do with the code you may not even need the frame reference.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

^^ Yep, that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I've used the Netbeans GUI builder for years and I don't know what you're referring to. Perhaps if you could be more specific someone could offer advice?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

convert for loop to a while loop
for count= 1 to 50
display count
End for

while (notPayingAttentionToTheRules) {
  ignore();
}

Start a new thread if you have a question. Show some effort if you would like assistance.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That error message should contain a little more information at the end. They are appending the string description on that line.

If you want more info than that, add an "e2.printStackTrace()" in the catch block. The app might need the images in the jar file. Open up the original jar and see what all is in there.

Edit: Yep, I just downloaded the app and checked. The images are in there as well. Try rebuilding your jar with

jar [B]u[/B]vf TunerApplet.jar TunerApplet.class

to update the existing jar (you may want to make a copy of it first :) )

samarudge commented: Very good information, helpful and quick response +2
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Could be he wants a butcher.
Or a hair stylist.
Or a clip-booker.

Or maybe just a freaky chick who plays with razorblades after all...

What's the verdict, thinkersgroup?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This is the Introductions forum - not the "Give me teh projectz" forum.

Closing.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Write code to parse this data and make a selection.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Here you have declared the type and size of the array

MovingPlatform[] platforms;
platforms = new MovingPlatform[1];

but you must still create an instance of each element

platforms[0] = new MovingPlatform();
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The code you posted won't compile - improper structure - which will certainly affect the visibility of those buttons.

You also haven't set howMany to any value.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, I would imagine that your college would prefer that you at least did a little work on it yourself. They probably have some policies about that.

Edit: Hmm, yeah, they do: http://ctech.smccme.edu/Policies.html#Academic_Honesty_and_Plagiarism_

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

"the instructor said that he knew for a fact that many schools admissions have access to a special type of Facebook admin rights where they can view profiles that are "locked" or "private"."
And I think that's a load of crap. School admissions do not have some magical override on privacy policies. I wouldn't have been able to take anything else the "instructor" said seriously after something like that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm writing a program for C++ and I must be missing something.

Yes, you are missing the fact that this is someone else's two year old thread and it's in Java, not C++.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Get riled up easily much?

This isn't me in "shook my cage" mode. You were suggesting that if the system has no value at all, it should be scrapped. I merely pointed out that only a few have voiced a negative view on it and that hardly constitutes a referendum on its uselessness. "Too simple?", yeah I would say so. Too simple to even consider the opinions of the majority don't necessarily equal the opinions of a couple of dissenters.

So there's some more honest feedback for you. Moderators can have opinions too. I'm not really concerned about who is licking what.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

ardav, it seems to me there are only a couple of people complaining about it. The majority haven't said one way or the other, so you really can't assume to know their feelings on it based upon one or two vocal opponents.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well boo-hoo to you!! There are a number of DaniWeb members ...

I think you got that backward. It was Jupiter2 who offered those as excuses. Bob only mentioned that he too was older and has injury to deal with, so he knew what that felt like. He was not claiming those as an excuse for anything. You're flaming the wrong side there.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

please i want the full code project solving 8 buzzle using depth and breadth first search ind if you can analyses and comparison between both algorithms
i hope as fast as you can

Any other homework you need us to provide ASAP on your demand? Perhaps just post your instructor's email address so we can send it in directly?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Er...do you even need to use all those data types??

Well, according to the OP, yes...

i have to write it using stacks and queues and using LinkedList with an iterator

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And I agree with Niek_e: airing this out in a public thread in Community Feedback is probably not the most productive way to address the situation.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Why not stick with the ButtonGroup? You can put both radio buttons and check boxes in the button group just fine. CheckboxGroup is for use with AWT Checkbox.

(By the way, you forgot

add(noSelectionButton);

in your code above. You created the button but didn't add it to the panel.)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

!!!!11!one!!oneone!!

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Maybe you want to reverse line 23?

shroomiin commented: always helpful +1
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Using the pattern (\w+?[RK]) with the regex Matcher.find() method will capture all of those groups except for the last one, which doesn't end with R or K.

Edit: This pattern \w+?[RK]|\G\w++$ seems to produce the result you wanted.

Pattern pat = Pattern.compile("\\w+?[RK]|\\G\\w++$");
String input = "AMLARMLAKFGFP";
Matcher matcher = pat.matcher(input);
while (matcher.find()){
    System.out.println(matcher.group());
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
KirkPatrick commented: you've always been helpful around here bud, the world needs more helpful people like you +1
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

My suggestion: learn how to type and communicate effectively. It will serve you well.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I think you are correct that the behavior did stem from some blocking, but this can still be simplified a great deal to work without a separate listening thread.

Here's a re-wired version of the same that behaves itself. It's worth noting that these two versions only differ in what kind of socket is created to make one the "server". They could be coalesced to a single class. (It's also a quickly slapped together modification that doesn't properly handle exceptions or shut down properly and close io streams :) )

package game;

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;

import javax.swing.*;

public class Clientms2 extends JFrame implements MouseListener {

    private static final long serialVersionUID = 1L;
    JFrame container;
    InetAddress address;
    Socket s;
    String host = "localhost";
    PrintWriter out = null;
    BufferedReader in = null;
    int port = 5656;
    String message;
    int mouseX, mouseY;

    boolean myTurn = true;
    JTextArea status = new JTextArea();

    public Clientms2() {
        super("Client 1: Player 1");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        //this.setResizable(false);
        addMouseListener(this);
        status.addMouseListener(this);
        add(status);
        pack();
        setSize(400, 400);
    }

    public static void main(String args[]) {
        Clientms2 client = new Clientms2();
        client.setVisible(true);
        client.run();
    }

    public void run() {
        try {
            address = InetAddress.getByName(host);
            s = new Socket(address, port);

            // establish streams one time
            out = new PrintWriter(s.getOutputStream(), true);
            in = new BufferedReader(new InputStreamReader(
                    s.getInputStream()));

            // start processing
            myTurn = true;
            String input = "";
            while ((input = in.readLine()) != null) {
                if (!myTurn) {
                    process(input);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void mouseClicked(MouseEvent …
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The problem is that all of your code, including the thread.sleep() calls, are executing on the AWT event queue thread, which is the same thread that handles the repaint calls to update the display. You have to separate the animation updates from the painting. One way to do that would be to wrap the code you currently have in the show() method into a small Runnable class

class LineAnimation implements Runnable{
        public void run() {
            Vector<Line> LINES = this.lines(POINTS);
            Vector<Line> PWLINES = new Vector<Line>();
            for (int i = 0; i < LINES.size(); i++) {
                PWLINES.add(LINES.get(i));
                this.G.transfer(POINTS, PWLINES);
                this.G.repaint();
                try {
                    Thread.sleep(500);
                } catch (Exception e) {
                }
            }
        }
    }

and start a new thread with that Runnable in your show method

Thread lineAnim = new Thread(new LineAnimation());
lineAnim.start();

As BestJewSinceJC mentioned, a Swing Timer can also be used for this.

kolibrizas commented: A very decent help to my problem! +1
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

y u a hater 4 nikka wow is a good game everyone plays it u just mad cause u cant hit lvl 80

Absolutely brilliant.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sounds like you probably need to fail then if you cannot show that you learned the material. Failing can be a great learning experience.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I agree that the "New" buttons are too large. I prefer the previous version that wasn't so intrusive.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Here is a "bare bones" mockup of how such an event model can be implemented. I've retained your names so it might be a little clearer

import java.util.ArrayList;
import java.util.List;

public class MainFrame implements SelectionListener {

    DataTable dataTable;
    String mainData;

    public MainFrame() {
        dataTable = new DataTable();
        // Add this as a listener to the DataTable objectd
        dataTable.addSelectionListener(this);
    }

    /** simulate the events and notification */
    public void run() {
        // initial state
        mainData = dataTable.getData();
        System.out.println(mainData);

        // data table gets updated (in reality this represents a user action,
        // but I have to simulate here)
        dataTable.updateSomeData();

        // verify our new data
        System.out.println(mainData);
    }

    /** implementation of SelectionListener interface */
    public void selectionChanged() {
        // get the updated data
        mainData = dataTable.getData();
    }

    public static void main(String[] args) {
        MainFrame mFrame = new MainFrame ();
        mFrame.run();
    }
}

class DataTable {

    private String someData = "initial data here";
    
    // list of listeners
    private List<SelectionListener> selectionListeners = new ArrayList<SelectionListener>();

    /** Add a SelectionListener */
    public void addSelectionListener(SelectionListener listener) {
        selectionListeners.add(listener);
    }

    /** notify SelectionListeners of change*/
    private void fireSelectionChanged() {
        for (SelectionListener listener : selectionListeners) {
            listener.selectionChanged();
        }
    }

    public String getData() {
        return someData;
    }

    /** This method just represents some operation that alters the data */
    public void updateSomeData() {
        // doing stuff...
        someData = "new data here now";
        
        // done, so let all the listeners know
        fireSelectionChanged();
    }
}

interface SelectionListener {

    void selectionChanged();
}
BestJewSinceJC commented: Very detailed and quality help +4
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm struggling a bit to understand the exact behavior you are aiming for, but if you're just saying that the "main frame" needs to take some action when the selection array changes, you can make a small listener model for this yourself very easily

interface SelectionListener {
    void selectionChanged();
}

/** These go in your DataTable class */
List<SelectionListener> selectionListeners = new ArrayList<SelectionListener>();

public void addSelectionListener(SelectionListener listener){
    selectionListeners.add(listener);
}   

private void fireSelectionChanged(){
    for (SelectionListener listener : selectionListeners){
        listener.selectionChanged();
    }
}

Your action listener would call fireSelectionChanged() to notify all listeners of a selection change. Your main frame can then query the info that it needs. If you wanted to send that data with the selection change event, you could make a small SelectionChangeEvent object to pass with that info.

You could also just wire up a ChangeListener or set up your selection list as a bound property of the DataTable.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Keep the point2 assignment and a repaint() in mouseDragged() . Leave mouseReleased() as you have it, but also set point2 to null. Then alter your paintComponent() method to draw a line from point1 to point2 if point2 is not null.

BestJewSinceJC commented: very helpful in this thread (acc. to OP) +4
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, evidently you it's something that you cannot do because you are here asking how to do it. I'd say you lost the bet.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There are existing wrapper classes for all of the primitive types.
Use Integer. Auto-boxing will handle the casting for you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
JimD C++ Newb commented: Pointed me in just the right direction. Thank you! +2
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you mean task instead of target, yes there is.
Read the documentation.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, dragging up a four-year-old thread in the wrong forum is not the way to go about it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Personally I'm surprised there aren't more sig link spamming "thanks for this informations!" posts in this thread yet.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

First you need help understanding the definitions of the words "complex" and "simple" and their relationship.