Cerberus 17 Junior Poster

There might be another way but i only know the method that i've explained above.

Cerberus 17 Junior Poster

It's not too difficult. Say you had a login page with two text areas (username and password) and a button (submit) you would use an HTML form like this...

<form method="post" action="authenticate.php">
username
<input type="text" name="txtusername">
password:
<input type="password" name="txtpassword">
<input type="submit" value="submit" name="btnsubmit">
</form>

When you click submit the text box input is sent to authenticate.php.

Cerberus 17 Junior Poster

Post (method="post") the html control data e.g. txtusername, txtpassword to your php page. Then on your php page you need to start_session() (or something like that) and then assign a value to the session variable e.g. $_SESSION = $_POST[txtusername].

Now you can access that variable while the session is live.

e.g.

<?php
    echo $_SESSION['varUserName'] //output user name
?>

My php is a bit rusty so it might not be exact.

Cerberus 17 Junior Poster

You could possibly store the username in the session variable after a successful login and then insert that value in the table.

Cerberus 17 Junior Poster

Do you mean you need the user to submit their name?

If so you could just use and HTML form and post it to your php page for processing.

Cerberus 17 Junior Poster

Thankyou.

Cerberus 17 Junior Poster

Thanks. So you mean you set the system up as normal: e.g. Apache, PHP, MySQL etc and then just configure the system so that it doesn't serve incomming requests?

I'll take a look at those links. Thanks.

Cerberus 17 Junior Poster

Hi, is it possible to set up a PHP development environment on a home PC. I assume you still need web server software, however, i only want it to practice my PHP coding and not open up my system to the Internet. I hope that makes sense.

Anyway if someone could point me in the right direction, thanks.

Cerberus 17 Junior Poster

Hi, can anyone recommend me a good text book with information about setting up an online business with content such as methods of financial transaction, search engine optimization, web business models, etc.

Thanks.

Cerberus 17 Junior Poster

I don't know if you can do it but it might be possible to display images using the <marquee> tags and maybe hyperlink them to some kind of popup window.

Cerberus 17 Junior Poster

The class calling the method needs a reference to the other class. For example, ClassA instantiates ClassB (Below) and ClassB needs to call a method provided by ClassA. The 'this' keyword can be passed into ClassB's constructor to provide it with a reference to ClassA.

E.g.

public class ClassA{
    ClassB subordinate;
 
    public static void main(String[] args){
        subordinate = new ClassB(this);
    }
 
    public void mymethod(){
        //do something
    }
}
public class ClassB{
    ClassA master;
 
    public ClassB(ClassA master){
        this.master = master;
        master.mymethod();
    }
}
Cerberus 17 Junior Poster

Thanks for the reply, i'll use a different solution.

Cerberus 17 Junior Poster

Thanks for the advice. I'll use Javascript.

It seems strange that Applets aren't so popular, as Java is a popular programming language. But i've never used flash so i couldn't really compare why you would choose one over the other.

Cerberus 17 Junior Poster

your could add some code like this

<html>
<head>
    <style type="text/css">
    <!--
    .textstyle{
        color: #aaaaaa;
    }
    -->
    </style>
</head>
<body>
    <a href="" class="textstyle">link</a>
</body>
</html>
Cerberus 17 Junior Poster

I want to use a slideshow on a web page, which could be implemented using either Javascript or an applet. Which on is the best option?

Thanks.

Cerberus 17 Junior Poster

Hi can anyone point me in the right direction to redefine the tabbing element of <pre> tags please.

Cerberus 17 Junior Poster

I think this is what you want.

import java.io.*;

public class ReadLine
{
    public static void main(String[] args)
    {
        try
        {
            InputStreamReader reader = new InputStreamReader(System.in);
            BufferedReader in = new BufferedReader(reader);
            System.out.print("enter text>>>");
            String str = in.readLine();
            System.out.println(str);
        }
        catch (IOException e) {}
    }
}
Cerberus 17 Junior Poster

Anyone?

Cerberus 17 Junior Poster

Wouldn't you just set the value to one higher then King e.g. King = 13, Ace = 14.

Cerberus 17 Junior Poster

I just created the getImage method and called it to place the image. With the code below you would have packed the jar with a folder containing 'myimage'. This code should work from a Jar.

import java.awt.*;
import javax.swing.*;
import java.net.URL;

public class JarImage
{
    public JarImage()
    {
        JFrame frame = new JFrame();
        JButton button = new JButton
            (new ImageIcon(getImage("images/myimage.gif")));
        frame.getContentPane().add(button, BorderLayout.SOUTH);

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(600, 500);
        frame.setLocation(300, 100);
        frame.setVisible(true);
    }
    
    private Image getImage(String pathName)
     {
         URL url = getClass().getResource(pathName); 
        Image image = Toolkit.getDefaultToolkit().getImage(url);
        return image;    
     }
    
    public static void main(String[] args)
    {
        JarImage jar = new JarImage();
    }
}
Cerberus 17 Junior Poster

Hi, i'm using a JTextPane that i've customized with a method to set up some tabstops. In my GUI class constructor i call the tabstop setup method and it works fine.

I'm having a problem though when i load text into the TextPane. Even though i call the tabstop setup method it doesn't seem to work. Anyone seen this before?

Cerberus 17 Junior Poster

Ok i've got it working now.

Thanks for your help.

Cerberus 17 Junior Poster

Thanks for the reply but i can't get it to work. When i use this i can run it through the IDE but when i try to run the jar the application won't even load. I've made sure that the manifest has the main class.

Cerberus 17 Junior Poster

I can't seem to get access to images in my application when i pack the executable jar file. I've tried everything i can find in examples and nothing is working.

Can anyone help please?

Is there a way of specifying where images are in the manifest file.

Cerberus 17 Junior Poster

Hi, can anyone recommend a 'simple' to use cross platform installer which is free.

I've looked at a few but they look quite complex.

Thanks.

Cerberus 17 Junior Poster

Declare this ( JTextField area = new JTextField(20);) variable outside the constructor.

Cerberus 17 Junior Poster

Nobody got a solution?

Cerberus 17 Junior Poster

I would find something you've written in C# (something not to complex) and try to implement it in Java.

The Sun website provides lots of tutorials.

http://java.sun.com/docs/books/tutorial/getStarted/index.html

Cerberus 17 Junior Poster

The error is saying that it can't find the 'main' method.

Did you try to run the '.Java' file?

try to run it without the extension

E.g.

java HelloWorld

instead of

java HelloWorld.java

Cerberus 17 Junior Poster

If you're using Swing i don't think the layout matters because you apply the menu bar to the frame

e.g. frame.setJMenuBar(myMenu)

If that doesn't help perhaps you could post some of your code.

Cerberus 17 Junior Poster

Hi, i've got a component that displays two JSpinners with a JOptionPane but the JSpinners are stretched across the dialog window. Does anyone know how i can format the JSpinners so they're smaller?

Here's some of the code

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;

public class TComponent
{
    private SpinnerNumberModel spinnerModel1;
    private SpinnerNumberModel spinnerModel2;
    private JSpinner spinner1;
    private JSpinner spinner2;
    private JOptionPane optionPane;
    private JDialog dialog;
    private JFrame frame;
    
    public TComponent(JFrame frame)
    {
        this.frame = frame;
        
        spinnerModel1 = new SpinnerNumberModel(5, 1, 30, 1);
        spinnerModel2 = new SpinnerNumberModel(5, 1, 30, 1);
        
        spinner1 = new JSpinner(spinnerModel1);
        spinner2 = new JSpinner(spinnerModel2);
        
        Object[] message = {"Spinner 1: ", spinner1,
                             "Spinner 2: ", spinner2};
                             
        Object[] options = {"OK", "Cancel"};
        
        optionPane = new JOptionPane(message,
                        JOptionPane.PLAIN_MESSAGE,
                         JOptionPane.OK_CANCEL_OPTION,
                          null, options);

        dialog = optionPane.createDialog(frame, "Spinners");
        dialog.show();
    }

    public static void main(String[] args)
    {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(600, 500);
        frame.setLocation(300, 300);
        frame.setVisible(true);
        
        TComponent op = new TComponent(frame);
    }
}
Cerberus 17 Junior Poster

I've been trying to install JOGL but can't seem to get it to work.

Can anyone give me a simple expanation of how to install it please.

Cerberus 17 Junior Poster

I've worked out what i needed to do. Sorry...

Cerberus 17 Junior Poster

Hi, could any one tell me how to model selection in communciation diagrams.

I know sequence is achieved by numbering the messages and iteration with (*).

Thanks.

Cerberus 17 Junior Poster

Hi, does anyone know if there is any way to maximize the standard CLI in Ada.

Thanks.

Cerberus 17 Junior Poster

Ok thanks i'll take a look at the example.

Cerberus 17 Junior Poster

but the setFileFilter method requires a FileFilter identifier not a String.

for example:

ExtensionFileFilter filter = new ExtensionFileFilter(text, "*.txt");
fileChooser.addChooseableFileFilter(filter);
chooser.setFileFilter(filter);

perhaps i'm misunderstanding.

Cerberus 17 Junior Poster

JFileChooser has a setFileFilter(FileFilter filter) method. I could call this by putting any of my custom filters in but i don't have an identifier for the default one. So basically i'm just wonding what the default identifier is.

Cerberus 17 Junior Poster

Hi, does anyone know how to set a JFileChoosers default filter back to accept all files after custom filters have been added?

Thanks.

Cerberus 17 Junior Poster

It works for me.

Is url a String?

Cerberus 17 Junior Poster

Try replaceAll() instead.

Cerberus 17 Junior Poster

I think that limiting user input is always good.

How about the JSpinner class. That should allow the user to input a large range of numbers (that you specify in the constructor).

Cerberus 17 Junior Poster

You could use component like a dropdown box to limit the users choices to a range of numbers.

Cerberus 17 Junior Poster

I reapplied a documentlistener to the text compent after a file was loaded. I needed to apply a change to another component when a file was loaded.

Problem solved.

Cerberus 17 Junior Poster

Hey, does anyone know what inteface is needed to listen for a file being loaded into a jtextcomponent.

Thanks.

Cerberus 17 Junior Poster

Problem solved!

I just used the JOptionPane setRootFrame(Frame newRootFrame) method, which seems to have anchored it to the main application window.

Cerberus 17 Junior Poster

Alt-tab works but i'd like for the jOptionPane to display without any effort so the user doesn't think the app has crashed.

Cerberus 17 Junior Poster

Hello. I'm using a JOptionPane to display some application information when the user selects the Help-About menu option.

If the about option has been selected and you click on an alternative application (e.g. a browser) when you return to the application the JOptionPane is lost and the application can't continue. You basically have to shut it down.

Any suggestions how i can keep the JOptionPane visible over the application?

Cerberus 17 Junior Poster

Thanks for the reply it sounds logical.

Cerberus 17 Junior Poster

Hi, i have a jtextpane and a JComponet that displays line numbers. Does anyone know how i can get the startline and end line of the text that is currently in view on the JTextPane?


Thanks.