Bitkistl

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Saturday, 12 May 2012

Writing a Toolbar with Java

Posted on 10:54 by Unknown

This Java example shows how to program a Toolbar by the use of a string array and an index for the buttons. It shows how to respond to click events.

import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.swing.JButton;
import javax.swing.JFrame;

public class mButton {


  String[] Kommandos = {"xterm" ,"gedit" ,"xclock"};       //Define some buttons
  JButton Jb[] = new JButton[Kommandos.length];


public mButton() {
   
    JFrame myframe = new JFrame("Buttons");   
    myframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    myframe.setLayout(new FlowLayout());   
    Font font = new Font("Dialog", Font.PLAIN, 30);
  
   
    for (int index=0; index < Kommandos.length; index++)
   
    {
    //System.out.println("index: " + index );
    Jb[index] = new JButton(Kommandos[index]);
    Jb[index].setFont(font);
    myframe.add(Jb[index]);
   
   
    Jb[index].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ev) {
                JButton theButton = (JButton) ev.getSource();
                String text = theButton.getText();
               
                //String num = theButton.getActionCommand();     
                //System.out.println(num);
                //System.out.println(text);

               try {
                Runtime.getRuntime().exec(text);        
                } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                }          
            }                  
    });
      
    myframe.pack();
    myframe.setLocationRelativeTo(myframe);    //center on screen
    myframe.setVisible(true);
    myframe.setResizable(false);
   
  }
}

public static void main(String[] args) {
    mButton myKommands = new mButton();
  }
 

}
Read More
Posted in | No comments

Wednesday, 9 May 2012

APT essentials

Posted on 12:49 by Unknown
With this commands most of your problems with linux packages can be solved.

apt-get update          /* update list of available packages
apt-get dist-upgrade    /* upgrade your linux distro
apt-cache search        /* search <name> packages
apt-cache show <name>   /* display package information for package
apt-get install <name>  /* install package <name>
dpkg -L <name>          /* list files installed for package <name>
dpkg -l                 /* list all installed packages
apt-get remove <name>   /* remove package <name>
apt-get remove --purge  /* remove also configuration files <name>
apt-get autoclean       /* /var/cache/apt/archives delete old archives
apt-get clean           /* delete apt archive

/var/lib/dpkg/status    /* text file which holds status of packages
                        /* can be edited to solve problems with      
                        /* broken packages

Read More
Posted in | No comments
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • Linux on ARM powered Devices
    This post should give an overview on which ARM powered devices GNU/Linux runs and also gives a hint how good it is supported on the respecti...
  • The Piface Interface board
    The PiFace is actually an I/O extender that uses the SPI bus to extend the I/O capabilities of the Raspberry Pi with 8 extra input and 8 ex...
  • The OUYA console, E-Book
    The OUYA is a $99 games console powered by a Tegra 3 processor (quadcore ARM). Do you want to know what can be done with the OUYA and where ...
  • ARM goes 64 Bit
    There are rumours that the ARM architecture will compete in the server market. The architecture is called ARMv8 and will run 32 and 64 Bit ...
  • The Utilite Computer
    The Utilite Computer is available with 1/2/4 Cortex A9 cores clocked at max. 1.2 Ghz. The Utilite is delivered with Ubuntu 12.04 pre-install...
  • APT essentials
    With this commands most of your problems with linux packages can be solved. apt-get update          /* update list of available packages apt...
  • Buch: Der Raspberry Pi Computer
    Der Raspberry Pi Computer (4 Euro für das e-Book als PDF Datei): Der Raspberry Pi ist ein scheckkartengroßer Computer mit USB,Video und LAN ...
  • Tiny Boards
    http://tinyboards.blogspot.com 
  • Raspberry Pi, E-Book
    The Raspberry Pi is a credit card sized Computer with USB, Video and Lan interfaces. Its primary use is for teaching computer science. E-Bo...
  • Writing a Toolbar with Java
    This Java example shows how to program a Toolbar by the use of a string array and an index for the buttons. It shows how to respond to click...

Blog Archive

  • ►  2013 (7)
    • ►  July (2)
    • ►  February (3)
    • ►  January (2)
  • ▼  2012 (4)
    • ►  November (1)
    • ▼  May (2)
      • Writing a Toolbar with Java
      • APT essentials
    • ►  April (1)
Powered by Blogger.

About Me

Unknown
View my complete profile