I can't get this to paint.
Hi, I am trying to get this create a new panel. And in that panel, I am trying to have some credits paint. I have not been able to get this to do anything more than give me an error (java.lang.NoSuchMethodError: main Exception in thread "main" ) or working but not displaying anything...
Can you help me by giving me some code help or pointing me in the correct direction.
Thanks
package RPGGame;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.*;
import javax.swing.*;
import java.net.*;
public class Main extends javax.swing.JFrame {
/** Creates new form Main */
int screen = 0;
//MidiClip creditss = new MidiClip();
Credits Credits;
boolean credits = false;
Image back;
Graphics gr;
public Main() {
initComponents();
initComponents2();
resize(750,750);
* WARNING: Do NOT modify this code.
private void initComponents() {//GEN-BEGIN:initComponents
titleBack = new javax.swing.JLabel();
aboutPanel = new javax.swing.JPanel();
aboutPanelOK = new javax.swing.JButton();
menuBar = new javax.swing.JMenuBar();
fileMenu = new javax.swing.JMenu();
newMenuItem = new javax.swing.JMenuItem();
openMenuItem = new javax.swing.JMenuItem();
saveMenuItem = new javax.swing.JMenuItem();
exitMenuItem = new javax.swing.JMenuItem();
helpMenu = new javax.swing.JMenu();
contentsMenuItem = new javax.swing.JMenuItem();
aboutMenuItem = new javax.swing.JMenuItem();
getContentPane().setLayout(null);
setCursor(new java.awt.Cursor(java.awt.Cursor.CROSSHAIR_CURSOR));
setFont(new java.awt.Font("Bookman Old Style", 0, 10));
setMaximizedBounds(new java.awt.Rectangle(25, 25, 750, 750));
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
titleBack.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
titleBack.setIcon(new javax.swing.ImageIcon("BackGround.GIF"));
titleBack.setText(" ");
titleBack.setBorder(new javax.swing.border.MatteBorder(null));
getContentPane().add(titleBack);
titleBack.setBounds(0, 0, 750, 730);
aboutPanel.setLayout(null);
aboutPanel.setBackground(new java.awt.Color(0, 0, 0));
aboutPanel.setBorder(new javax.swing.border.MatteBorder(null));
aboutPanel.setForeground(new java.awt.Color(255, 0, 0));
aboutPanelOK.setBackground(new java.awt.Color(0, 0, 0));
aboutPanelOK.setForeground(new java.awt.Color(255, 0, 0));
aboutPanelOK.setText("OK");
aboutPanelOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
aboutPanelOKActionPerformed(evt);
aboutPanel.add(aboutPanelOK);
aboutPanelOK.setBounds(289, 310, 75, 26);
getContentPane().add(aboutPanel);
aboutPanel.setBounds(50, 150, 650, 350);
menuBar.setBackground(new java.awt.Color(0, 0, 0));
menuBar.setForeground(new java.awt.Color(0, 255, 0));
menuBar.addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
menuBarComponentResized(evt);
fileMenu.setBackground(new java.awt.Color(0, 0, 0));
fileMenu.setForeground(new java.awt.Color(0, 255, 0));
fileMenu.setText("File");
fileMenu.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
fileMenuActionPerformed(evt);
newMenuItem.setBackground(new java.awt.Color(0, 0, 0));
newMenuItem.setForeground(new java.awt.Color(0, 255, 0));
newMenuItem.setText("New Game");
newMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
newMenuItemActionPerformed(evt);
fileMenu.add(newMenuItem);
openMenuItem.setBackground(new java.awt.Color(0, 0, 0));
openMenuItem.setForeground(new java.awt.Color(0, 255, 0));
openMenuItem.setText("Load Game");
openMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
openMenuActionPerformed(evt);
fileMenu.add(openMenuItem);
saveMenuItem.setBackground(new java.awt.Color(0, 0, 0));
saveMenuItem.setForeground(new java.awt.Color(0, 255, 0));
saveMenuItem.setText("Save Game");
saveMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveMenuItemActionPerformed(evt);
fileMenu.add(saveMenuItem);
exitMenuItem.setBackground(new java.awt.Color(0, 0, 0));
exitMenuItem.setForeground(new java.awt.Color(0, 255, 0));
exitMenuItem.setText("Exit");
exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exitMenuItemActionPerformed(evt);
fileMenu.add(exitMenuItem);
menuBar.add(fileMenu);
helpMenu.setBackground(new java.awt.Color(0, 0, 0));
helpMenu.setForeground(new java.awt.Color(0, 255, 0));
helpMenu.setText("Help");
contentsMenuItem.setBackground(new java.awt.Color(0, 0, 0));
contentsMenuItem.setForeground(new java.awt.Color(0, 255, 0));
contentsMenuItem.setText("Contents");
contentsMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
contentsMenuItemActionPerformed(evt);
helpMenu.add(contentsMenuItem);
aboutMenuItem.setBackground(new java.awt.Color(0, 0, 0));
aboutMenuItem.setForeground(new java.awt.Color(0, 255, 0));
aboutMenuItem.setText("About");
aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
aboutMenuActionPerformed(evt);
helpMenu.add(aboutMenuItem);
menuBar.add(helpMenu);
setJMenuBar(menuBar);
pack();
}//GEN-END:initComponents
private void aboutPanelOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutPanelOKActionPerformed
aboutPanel.setVisible(false);
}//GEN-LAST:event_aboutPanelOKActionPerformed
private void initComponents2() {//second part of initComponents
aboutPanel.setVisible(false);
back = createImage(650,350);
gr = back.getGraphics();
Credits = new Credits(gr, back);
private void aboutMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuActionPerformed
aboutPanel.setVisible(true);
Credits.paintCredits();
}//GEN-LAST:event_aboutMenuActionPerformed
private void saveMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveMenuItemActionPerformed
// Add your handling code here:
}//GEN-LAST:event_saveMenuItemActionPerformed
private void fileMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileMenuActionPerformed
// Add your handling code here:
}//GEN-LAST:event_fileMenuActionPerformed
private void openMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openMenuActionPerformed
// Add your handling code here:
}//GEN-LAST:event_openMenuActionPerformed
private void contentsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_contentsMenuItemActionPerformed
// Add your handling code here:
}//GEN-LAST:event_contentsMenuItemActionPerformed
private void menuBarComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_menuBarComponentResized
// Add your handling code here:
}//GEN-LAST:event_menuBarComponentResized
private void newMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newMenuItemActionPerformed
// Add your handling code here:
}//GEN-LAST:event_newMenuItemActionPerformed
private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
System.exit(0);
}//GEN-LAST:event_exitMenuItemActionPerformed
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
System.exit(0);
}//GEN-LAST:event_exitForm
* @param args the command line arguments
public static void main(String args[]) {
new Main().show();
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem aboutMenuItem;
private javax.swing.JPanel aboutPanel;
private javax.swing.JButton aboutPanelOK;
private javax.swing.JMenuItem contentsMenuItem;
private javax.swing.JMenuItem exitMenuItem;
private javax.swing.JMenu fileMenu;
private javax.swing.JMenu helpMenu;
private javax.swing.JMenuBar menuBar;
private javax.swing.JMenuItem newMenuItem;
private javax.swing.JMenuItem openMenuItem;
private javax.swing.JMenuItem saveMenuItem;
private javax.swing.JLabel titleBack;
// End of variables declaration//GEN-END:variables
package RPGGame;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.*;
import javax.swing.*;
import java.net.*;
public class Credits {
FontMetrics fm;
Image[] menu=new Image[4];
int xDraw = 650;
int yDraw = 200;
Shape oldclip;
Image back;
Graphics gr;
String[] text = new String[14];
public Credits(Graphics abc, Image cba) {
text[0]="RPG Game";
text[1]="________________________";
text[2]="";
text[3]="Head Programmer";
text[4]="________________________";
text[5]="Matt Schott";
text[6]="";
text[7]="Looser #1";
text[8]="________________________________";
text[9]="Kyle";
text[10]="";
text[11]="Looser #2";
text[12]="___________________________________";
text[13]="Andy";
gr = abc;
back = cba;
public void paintCredits() {
gr.drawString(text[0], xDraw, yDraw);
gr.drawString(text[1], xDraw, yDraw-5);
gr.drawString(text[2], xDraw, yDraw-10);
gr.drawString(text[3], xDraw, yDraw-15);
gr.drawString(text[4], xDraw, yDraw-20);
gr.drawString(text[5], xDraw, yDraw-25);
gr.drawString(text[6], xDraw, yDraw-30);
gr.drawString(text[7], xDraw, yDraw-35);
gr.drawString(text[8], xDraw, yDraw-40);
gr.drawString(text[9], xDraw, yDraw-45);
gr.drawString(text[10], xDraw, yDraw-50);
gr.drawString(text[11], xDraw, yDraw-55);
gr.drawString(text[12], xDraw, yDraw-60);
gr.drawString(text[13], xDraw, yDraw-65);
}
This thread should get you started:
http://forum.java.sun.com/thread.jsp?forum=31&thread=452259
However, an easier way to create an About panel is to create a bunch of labels and add them to the panel. This way you don't have to worry about positioning them and sizing your dialog.
Similar Messages
-
How can i get this kind of background
Hello,
I downloaded some brushes in here : http://differentxdreamz.deviantart.com/art/Abstract-Design-Brushes-119627540.
I just want to do the same background with those brushes but i could'nt. I've made a lot of gradient colors but it's not like this picture.
Some descriptions of the differents steps would be very useful for me.
Also, how can i get this mix of colors in the bottom of this picture : http://www.shutterstock.com/pic.mhtml?id=56261755
ThanksHi,
To get blurred colors you can use a bluring technique. Start off by painting large spots of color on your image.
Go to FIlter > Blur > Gaussian Blur:
Then, change the intensity of the blur to your liking
As far as the other image, that seems a little more complicated and requires some more steps.
Here's the tutorial for that image:
http://differentxdreamz.deviantart.com/art/Abstract-Aura-Tutorial-123825904
Hope this helps!
Julia -
Just installed CS5 onto new computer. Adobe bridge and CS5 do not recognize CR format. How can I get this installed. I have tried up dating and downloading the CR6.7 update, but can not get it to install. What do I do?
Product updates
-
Hello, I want to restore a backup from this afternoobut in i-tunes it is not visseble. When I'll look on te pc: (username)\Application Data\Apple Computer\MobileSync\Backup\ it's there! How can I get this backup to my iphone or itunes? Thanks in advance!
Follow the steps in this article to restore from iTunes back up:
http://support.apple.com/kb/HT1766
Since you say you cant see the back up in iTunes you should be able to see it when following the last step where it says for iTunes 10.7 or earlier. Dont worry as this step also works for iTunes 11. -
I have installed the cars 2 app mate on a ipad 2 from an ipad 1 synced with itunes account.. all is working except this app. After many times of un installing and re installing aswell as talking to apple tech suport this app is still not working.... its there it just has no function...... how can i get this installed and working, my grandson is autistic and uses this app many hours a day........ it is important for me to get this up and running again for him.......
(1) So, I found a youtube video showing how to open up my iMac and replace a Disk drive. I opened it. I removed the disk drive. I opened the metal cover of the lid of the disk drive. It was clean and immaculate; so, it destroyed and debunked the dirty drive theory. But, just to make sure I sucked around the optical sensor with a vacuum and gently brushed it with a Q-tip.
(2) I then watched a you tube video showing how the drive operated (it was a drive supplied with power outside an iMac with a transparent cover unlike the opaque metal cover that we have on our drives). My scientific curiosity started to wonder if somehow the mechanical part (of the electro-mechanical assembly) was locked or jammed. So, I started messing with the arms with the utmost care after watching the video to see if i could move them manually. Yes on some. The main arm that is linked with the drive motor was immovable. The rest I played with a little bit, took great notice in the start of the video to see how the arms looked before inserting a disk. I then put it all back together.
It works now. My guess is that taking it out and then placing it back in along with the resetting options that others have done was the trick. I believe it is a possibility that the hard drive became locked mechanically in some strange manner after ejecting a DVD in conjunction with the uploading of the new OS. I believe the actual removal, reinstallation, and resetting of the drive put everything back into sync. My computer sits in a climate controlled dust free environment. I knew for a fact that this hard drive was OKAY. -
My iPod Classic is seen by Windows but not by iTunes. I have reset it, gone to disk mode and it won't show up in iTunes. There appears to be music on it in a file called MUSICSAVE. How can I get this to work with iTunes again?
1. Update iTunes to the latest version. Plug in your iPod. If iTunes still can't recognize it, then in iTunes in the top left corner click help> run diagnostics. On the box that comes up, check the last two things. Click next and it should identify your iPod.
2. Click on your windows start menu. Type in "services". Click on it and when it pops up, on the bottom of it click on "standard". Now Scroll down to find "Apple Mobile Device" Right click it when you see it and click on "Start". When it has started, close iTunes and replug in your iPod and it should show up.
3. Check the USB cable
4 Verify that Apple Mobile Device Support is installed
5. Restart the Apple Mobile Device Service and verify that the Apple Mobile Device USB Driver is installed.
6. If you just want to add some photos, songs and movies from computer to your devices, you can use an iTunes alternative to do the job
7. Check for third-party software conflicts.
<Link Edited By Host> -
My "Hanging with Friends" app keeps crashing whenever I try to open it. I have deleted and re-downloaded the app, restarted my iPhone, and even restored my iPhone all together, and nothing is working. How can I get this app to work again?
Can you start Firefox in [[Safe mode]] ?
You can also do a clean reinstall and download a fresh Firefox copy from http://www.mozilla.com/firefox/all.html and save the file to the desktop.
Uninstall your current Firefox version and remove the Firefox program folder before installing that copy of the Firefox installer.
It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
You can initially skip the step to create a new profile, that may not necessary for this issue.
See http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall -
User created apple id account, verified but know she is unable to log on, it says incorrect password, she tried to reset via forgot password option but it does not send reset password page to here e- mail address, how can i get this sorted? or how can i get her whole apple account deleted and created new one using same e - mail address?
The idea to jumpstart by change was not the smartest one, but gives you an opportunity to use that "temporary" account as permanent. You do not have a choice cause obviously despite you thinking that old account is no more -it does exist on Apple servers. And if you are unwilling to share your [email protected] with friend, just create one extra [email protected] for your friend. One suggestion - do not use gmail.
-
When I am home, calls to my iPhone 5 also go to my other family members' iPhones. How can I get this to stop happening?
Or better yet, create and use new Apple IDs for others in your household. You could always use different Apple IDs for iCloud services (like iMessage and FaceTime) and iTunes and App Store., but it's even easier to share purchased content now with Family Sharing.
-
I bought 3 iPhone 4s and each should have 5gb of cloud. I want to only use my one iTunes ID. How can I get this storage space increased to the 15 GB?
iCloud storage is not allocated by device. iCloud storage is allocated to your iCloud AppleID. You get 5GB of iCloud storage.
-
Somehow my iTunes app has been put into the trash. How can I get this and all of the stuff that was in it back to my Application folder? I try to drag it out of trash, but it won't work.
Also, when I do try to drag it out of the Trash to put it back into Applications (on the Finder sidebar), it asks me to authenticate with the administration password. I enter it, and then a window appears saying that I can't do that because I do not have permission to modify iTunes. Please help.
-
My ipod nano was synced by itunes and removed all of my music and game files, and replaced my music with my kids music that they have put into the current itunes library. My music is nowhere to be found on my computer, so now I am in the long, forever process of adding my music back one cd at a time, but there is no history of tetris that I paid for from the itunes store. How can I get this game back for my ipod?
Contact iTunes support and explain your situation to them. They may let you redownload it at no cost.
http://www.apple.com/support/itunes/contact.html
If they don't, I'm afraid you'll have to purchase it again. Sorry.
B-rock -
In disk utility, it shows that my external hard drive is somehow unmounted and I can't access it in finder or repair it in Disk Utility. How can I get this working without losing my important data?
Thank you!When you erased the disk did you select Mac OS Extended Journaled as the format option?
-
I recently reset my computer to factory settings. I re-downloaded iTunes, but lost most of my music and all of my playlists in both iTunes and my 4S. How can I get this back?
Restore your media from the backup of the computer created prior to restoring the computer.
You did create a backup, correct? Not doing so would be extremely unintelligent.
iOS devices are NOT backup devices. -
I just upgraded to Firefox 3.6.13 this morning and now, when I click on a link in an email or webpage, it won't open Firefox. How can I get this option restored in Firefox so I don't have to copy and paste the link?
See this lnk for a fix, it worked for me!
http://www.pcworld.com/article/200103/fix_outlook_general_failure_error_for_email_links.html
Maybe you are looking for
-
Help!!! Ipod not recognised!
Hey I have an ipod nano that is not being recognised by itunes!!! I've been following the web sites instructions but itunes still doesn't recognise it. WHAT SHOULD I DO?????
-
been working for 4 hours to get this thing to work.
-
Does anyone know if you can link an iPad or iPhone to a television after updating to ios6?
-
Hello , Can anyone please give me a hint on how to use the ResultSet to populate the JTable from the database , I have my ResultSet ready but I'm confused about how to use it , do I have to create a String Array to hold each row , and another to hold
-
Initialisation data load failure
Hi all, My initialisation data load for 0EC_PCA_3 failed with an error message "Selected No does not agree with transferred no." , the data processing is ok. I am pasting the shrot dump from the source system below. Error analysis