Requision for Authors for Attachment file enabling
[QUOTE=muthukutta1;287156]Hello
Can any one help to let me know why a jar fle that i created using jar option,invariably tells that jar is unable to load my manifest file.
What coud be the possible errors for this kind of trouble in the opening of a jar file .Also tell about serialisation of variables that i use in the appl,if it has a negative trend,in case of its (seralisation) not implemented for the appl program before making a jar .
The following Code in java (an application Prog)
needs to be jarred.though the try out by jartool is not possible since this prog requires class files and a manifest file along with src.
If the attachment forwarding is enabled by authors a zip file can be forwarded by which you can help me to create the jar file .Please reply soonThanks
muthukutta1</QUOTE>
<CODE>
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.logging.*;
import java.util.Random;
import javax.swing.border.*;
public class GridBagLayoutPanel extends JPanel implements ActionListener
{ //private GridbagLayoutPanel gbl;
private JLabel messageText;
private JLabel label;
private JPanel topPanel = new JPanel();
private JPanel results = new JPanel();
private JComboItems cbCricketGroundItem;
private JRadioButton buttonlegspinner = new JRadioButton("Legspinner");
private JRadioButton buttonoffspinner = new JRadioButton("Offspinner");
private JRadioButton buttonfastbowling = new JRadioButton("Fastbowling");
private String msg = "";
private ButtonGroup group = new ButtonGroup();
private static final Font messageFont = new Font("Sans Serif", Font.BOLD, 20);
private static final Font listFont = new Font("Sans Serif", Font.BOLD, 14);
private static Logger logger = Logger.getLogger("GridbagLayout");
private String[] data = {"Legspinner",
"Offspinner",
"Fastbowling"};
public GridBagLayoutPanel() {
setSize(200, 150);
cbCricketGroundItem = new JComboItems();
cbCricketGroundItem.addActionListener(this);
label = new JLabel("bowlingitem: ");
label.setFont(messageFont);
RadioListener radioListener = new RadioListener();
buttonlegspinner.addActionListener(radioListener);
buttonoffspinner.addActionListener(radioListener);
buttonfastbowling.addActionListener(radioListener) ;
buttonlegspinner.setMnemonic('1');
buttonoffspinner.setMnemonic('2');
buttonfastbowling.setMnemonic('3');
group.add(buttonlegspinner);
group.add(buttonoffspinner);
group.add(buttonfastbowling);
JPanel radioPanel = new JPanel();
radioPanel.setLayout(new GridLayout(0, 1));
radioPanel.add(buttonlegspinner);
radioPanel.add(buttonoffspinner);
radioPanel.add(buttonfastbowling);
final JList list = new JList(data);
MouseListener mouseListener = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
logger.info("Double clicked: " + list.locationToIndex(e.getPoint()));
msg = data[list.locationToIndex(e.getPoint())];
displayMessage();
}
}
};
list.setFont(listFont);
list.addMouseListener(mouseListener);
JScrollPane listScroller = new JScrollPane(list);
listScroller.setPreferredSize(new Dimension(100, 125));
listScroller.setBorder(new TitledBorder("Double-click query for item value"));
topPanel.add(label);
topPanel.add(cbCricketGroundItem);
topPanel.add(radioPanel);
topPanel.setBorder(new TitledBorder("CricketGround"));
messageText = new JLabel("Please pick a bowling item...");
messageText.setFont(messageFont);
results.add(messageText);
results.setPreferredSize(new Dimension(400, 50));
results.setBorder(BorderFactory.createLineBorder (Color.blue, 2));
results.setBackground(Color.yellow);
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.weightx = 0.5;
c.insets = new Insets( 2, 2, 2, 2 );
c.fill = GridBagConstraints.BOTH;
add(topPanel, c);
c.gridy = 1;
c.weightx = 0.5;
c.gridwidth = 1;
c.fill = GridBagConstraints.HORIZONTAL;
add(listScroller, c);
c.gridx = 0;
c.gridy = 2;
c.weightx = 0.0;
c.insets = new Insets( 50, 50, 0, 0 );
c.fill = GridBagConstraints.NONE;
add(results, c);
}
public void actionPerformed(ActionEvent e) {
JComboItems cb = (JComboItems)e.getSource();
Command obj = (Command)e.getSource();
msg = (String)cb.getSelectedItem();
logger.info("[actionPerformed:] " + msg);
if (!msg.equals("Pick a bowlingitem?")) {
obj.execute();
logger.info("Execute being performed...");
}
}
class JComboItems extends JComboBox implements Command {
public JComboItems() {
this.addItem("Pick a bowlingitem?");
this.addItem("legspinner");
this.addItem("offspinner");
this.addItem("fastboling");
setFont(messageFont);
}
public void execute() {
displayMessage();
}
}
public void displayMessage() {
BowlingItemText text = new BowlingItemText();
if (msg.equals("Legspinner"))
((CricketGround)new Legspinner()).accept(text);
else if (msg.equals("Offspinner"))
((CricketGround)new Offspinner()).accept(text);
else if (msg.equals("Fastbowling"))
((CricketGround)new Fastbowling()).accept(text);
messageText.setFont(messageFont);
messageText.setText(text.getCost());
results.add(messageText);
}
public interface Command {
public void execute();
}
class RadioListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
logger.info("actionCommand = " + e.getActionCommand());
msg = e.getActionCommand();
displayMessage();
}
}
static public void main(String argv[])throws Exception {
//bl.GridbagLayoutPanel();
JFrame frame = new JFrame("GridBagLayout");
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
});
frame.getContentPane().add(new GridBagLayoutPanel(), BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
}
</CODE>
Last edited by muthukutta1; October 30th, 2012 at 01:16 AM..
Reason: A sample code with code tag
|