Alignment in layout

Hi Experts,
I have enhanced webdynpro application by adding additional field in the layout. Now the field is added under a new transparent container outside the standard fields transparent container.
The layout is matrix layout for both and the new transparent container i have added is set to MatrixHeadData under Layout Data.
Now the new elements added under the transparent container  are not aligned in similar way as the standard container. Its coming as shown below, is there anyway I can change the property so that the formatting of the new elements is same as
Field A   :   __________________
Field B   :   __________________
ZFIELD LONG TEXT A : _________________
If the Z field was added under the standard transparent container then the whole alignment would have been taken based on the longest field label and output would be like
Field A            :  __________________
Field B            :  __________________
ZFIELD LONG TEXT A :  _________________
Is it possible to have output similar to this by using two transparent containers. I want to influence the arrangement of the field based on the new transparent container for the standard container also.
thanks

Dear Srinivas ,
the only alternative is for you to change at runtime your view layout.
You will need to enhance the method WDDOMODIFYVIEW and apply your changes there.
Kind Regards
/Ricardo Quintas

Similar Messages

  • OpenHub Alignment issue

    Hi SAP Team,
    I have issue related to OpenHub document,the position or the order or the sequence of data fields are not in sync with how i created the OpenHub destination.
    Also after saving the new OpenHub destination created out of cube/dso ,revisiting it shows in different order and is not in the correct sequence.
    Do let me know the reason or some suggestion on that.
    Thanks!

    user567159,
    Yes. So, there are a couple of options afh:tableLayout layouts components out with a traditional html table. You can also nest af:panelGroups, which will lay components out as divs. If you are looking for a center aligned form layout, try af:panelForm. Hope that helps.
    --RiC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Group Layout- Button not displaying correctly

    Hello all,
    I am having a problem with group layout and having a button display incorrectly. Here is my code:
         public HRES_AboutBox(){
              initComponents();
         private void initComponents(){
              //--------Set-Up---Frame------------
              frameLocation = Toolkit.getDefaultToolkit().getScreenSize();
              frameWidth = frameLocation.width;
              frameHeight = frameLocation.height;
              aboutFrame = new JFrame(FRAMETITLE);
              aboutFrame.setPreferredSize(new Dimension(487,212));
              aboutFrame.setLocation(frameWidth / 4, frameHeight / 4);
              aboutFrame.setMaximumSize(new Dimension(800,600));
              aboutFrame.pack();
              aboutFrame.setVisible(true);
              aboutFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
              aboutFrame.setTitle(FRAMETITLE);
              setupComponents();
    private void setupComponents(){
         //--------Set-Up---Button------------
         closeButton = new JButton();
         closeButton.setName(BUTTONNAME);
         //--------Set-Up---Logo------------
         picURL = HRES_AboutBox.class.getResource("/testLogo.jpg");
         appPic = new ImageIcon(picURL);
         //--------Set-Up---Labels------------
         appTitleLabel = new JLabel();
         versionLabel = new JLabel();
         appVersionLabel = new JLabel();
         vendorLabel = new JLabel();
         appVendorLabel = new JLabel();
         homepageLabel = new JLabel();
         appHomepageLabel = new JLabel();
         appDescLabel = new JLabel();
         imageLabel = new JLabel();
         appTitleLabel.getFont().deriveFont
            (appTitleLabel.getFont().getStyle()| Font.BOLD, appTitleLabel.getFont().getSize() + 4);
         appTitleLabel.setText("T.E.S.T - Test Text for Label");
            appTitleLabel.setName("Application Title Label");
         versionLabel.getFont().deriveFont
           (versionLabel.getFont().getStyle() | Font.BOLD, versionLabel.getFont().getSize() + 4);
            versionLabel.setText(VERSIONLABELSTRING);
            versionLabel.setName("Version Label");
            appVersionLabel.setText(APPVERSIONLABELSTRING);
            appVersionLabel.setName("Application Version Label");
            vendorLabel.getFont().deriveFont
           (vendorLabel.getFont().getStyle() | Font.BOLD, vendorLabel.getFont().getSize() + 4);
            vendorLabel.setText(VENDORLABELSTRING);
            vendorLabel.setName("Vendor Label");
            appVendorLabel.setText(APPVENDORLABELSTRING);
            appVendorLabel.setName("Application Vendor Label");
            homepageLabel.getFont().deriveFont
            (homepageLabel.getFont().getStyle()| Font.BOLD, homepageLabel.getFont().getSize() + 4);
            homepageLabel.setText(HOMEPAGELABELSTRING);
            homepageLabel.setName("Homepage Label");
            appHomepageLabel.setText(APPHOMEPAGELABELSTRING);
            appHomepageLabel.setName("Application Homepage Label");
            appDescLabel.setText(APPDESCLABELSTRING);
            appDescLabel.setName("Application Description Label");
            imageLabel.setIcon(appPic);
            imageLabel.setName("Image Label");
            //--------Set-Up---Layout------------
            layout = new GroupLayout(aboutFrame.getContentPane());
            aboutFrame.getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                     layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                     .addGroup(layout.createSequentialGroup()
                         .addComponent(imageLabel)
                         .addGap(18, 18, 18)
                         .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                             .addGroup(GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                 .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                     .addComponent(versionLabel)
                                     .addComponent(vendorLabel)
                                     .addComponent(homepageLabel))
                                 .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                 .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                     .addComponent(appVersionLabel)
                                     .addComponent(appVendorLabel)
                                     .addComponent(appHomepageLabel)))
                             .addComponent(appTitleLabel, GroupLayout.Alignment.LEADING)
                             .addComponent(appDescLabel, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)
                             .addComponent(closeButton))
                         .addContainerGap())
              layout.setVerticalGroup(
                     layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                     .addComponent(imageLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                     .addGroup(layout.createSequentialGroup()
                         .addContainerGap()
                         .addComponent(appTitleLabel)
                         .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                         .addComponent(appDescLabel)
                         .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                         .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                             .addComponent(versionLabel)
                             .addComponent(appVersionLabel))
                         .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                         .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                             .addComponent(vendorLabel)
                             .addComponent(appVendorLabel))
                         .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                         .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                             .addComponent(homepageLabel)
                             .addComponent(appHomepageLabel))
                         .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
                         .addComponent(closeButton)
                         .addContainerGap())
              pack();
         public void closePasswordBox(){
              dispose();
         public static void main(String [] args){
              HRES_AboutBox hra = new HRES_AboutBox();
              if(hra.isVisible() == false){
                   hra.setVisible(true);
    }When I run this it comes out fairly alright but the button in the lower right corner does not display correctly, i have tried setting the size of the button but that does not solve the problem. If anyone can give any advice or info on how to get it to display right I would appreciate it.

    Hi,
    I usually only use the GroupLayout when using a GUI builder like the one in NetBeans.
    If I need to layout something manually I usually use a combination of the other layout managers.
    Sometimes I combine the two: eg. static layout with the GUI builder, dynamic layout by hand
    But if you want to use the GroupLayout manually, check:
    http://java.sun.com/docs/books/tutorial/uiswing/layout/group.html
    Otherwise check:
    http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html

  • How to set alignment in a TextField?

    I need to set allignment of the text in a TextField to right. There is no such under TextField.
    Anybody knows how to set alignment in a textfield in javaFX 2.0 ?
    Thanks

    It may be worth filing a feature request jira to get platform native support for this.
    You might think that textField.setStyle("-fx-text-alignment: right;") would work, but it does not.
    I guess that the -fx-text-alignment css property only right aligns multi-line text, not text within a text field.
    The following code uses binding to keep Text in a TextField right aligned.
    The translations place the text visually right and keyboard editing is OK.
    Mouse transparency is enabled because mouse based selections still act as though the text is left aligned.
    So it's not a complete solution.
    public void start(final Stage stage) throws Exception {
      // create a text field.
      final TextField textField = new TextField("This is right aligned text");
      textField.setStyle("-fx-text-alignment: right;");
      textField.setMinWidth(400);
      textField.setMouseTransparent(true);
      // layout the scene.
      final VBox layout = new VBox();
      layout.setStyle("-fx-background-color: cornsilk; -fx-padding: 10; -fx-alignment: center;");
      layout.getChildren().addAll(textField);
      Scene scene = new Scene(layout);
      stage.setScene(scene);
      stage.show();
      // keep the text in the textbox right aligned.
      final Text text = (Text) textField.lookup("Text");
      rightAlign(text, textField);
      textField.textProperty().addListener(new InvalidationListener() {
        @Override public void invalidated(Observable observable) {
          rightAlign(text, textField);
    private void rightAlign(Text text, TextField textField) {
      text.getParent().translateXProperty().bind(textField.widthProperty().subtract(text.xProperty().multiply(2)).subtract(text.getLayoutBounds().getWidth()));
    }

  • CSS Layout Trouble

    Here is a
    problem child I am working on.
    I have tried different orders with the divs and clears, etc,
    but i cannot get the main content div to stick to the top.
    Attached is the style sheet.

    Set the margin-top to 0
    Gary
    "OlDirty" <[email protected]> wrote in message
    news:[email protected]...
    >
    http://php.wmsgroup.com/eofd6.org/education.html
    >
    > I have tried different orders with the divs and clears,
    etc, but i cannot
    > get
    > the main content div to stick to the top.
    >
    > Attached is the style sheet.
    >
    > /* Top Elements */
    > * {
    > margin: 0px;
    > padding: 0px;
    > }
    > body {
    > font: 12px/1.5em Arial, Helvetica, sans-serif;
    > color: #FFFFFF;
    > background: #FFFFFF;
    > text-align: left;
    > }
    >
    > /* links */
    > a, a:visited {
    > color: #999999;
    > background: inherit;
    > text-decoration: none;
    > }
    > a:hover {
    > color: #333333;
    > background: inherit;
    > padding-bottom: 0;
    > text-decoration: underline;
    > }
    > a.gallery, a.gallery:visited {
    > color: #FFFFFF;
    > text-decoration: underline;
    > }
    > a.gallery:hover {
    > color: #FFFFFF;
    > text-decoration: none;
    >
    > /* headers */
    > }
    > #volunteer h1 {
    > font: normal 18px Georgia, "Times New Roman", Times,
    serif;
    > color: #660000;
    > padding-bottom: 10px;
    > }
    > #content h1 {
    > font: normal 22px Georgia, "Times New Roman", Times,
    serif;
    > color: #650000;
    > padding-bottom: 10px;
    > }
    > #gallery h1 {
    > display: block;
    > color: #FFFFFF;
    > letter-spacing: -1px;
    > padding-bottom: 10px;
    > font: normal 20px Georgia, "Times New Roman", Times,
    serif;
    > }
    > h2 {
    > font: normal 18px Georgia, "Times New Roman", Times,
    serif;
    > padding-bottom: 6px;
    > border-bottom: 1px solid #999999;
    > width: 300px;
    >
    > /* images */
    > }
    > .floatright {
    > float: right;
    > margin: 8px;
    > border: 1px solid #CCCCCC;
    > background: #EFEFEF;
    > padding: 10px;
    >
    > /* form elements */
    > }
    > form {
    > margin:10px; padding: 0 5px;
    > background: #F5F5F5;
    > }
    > label {
    > display:block;
    > font-weight:bold;
    > margin:5px 0;
    > }
    > input {
    > padding:2px;
    > border:1px solid #eee;
    > font: normal 1em Verdana, sans-serif;
    > color:#777;
    > }
    > textarea {
    > width:400px;
    > padding:2px;
    > font: normal 1em Verdana, sans-serif;
    > border:1px solid #eee;
    > height:100px;
    > display:block;
    > color:#777;
    > }
    > input.button {
    > font: bold 12px Arial, Sans-serif;
    > height: 24px;
    > margin: 0;
    > padding: 2px 3px;
    > color: #333;
    > background: #e7e6e6 url(button.jpg) repeat-x;
    > border: 1px solid #dadada;
    > }
    >
    > /* search form */
    > .searchform {
    > background-color: transparent;
    > border: none;
    > margin: 0 5px 0 10px; padding: 5px 0 15px 0;
    > width: 190px;
    > }
    > .searchform p { margin: 0; padding: 0; }
    > .searchform input.textbox {
    > width: 100px;
    > color: #777;
    > height: 18px;
    > padding: 2px;
    > border: 1px solid #E5E5E5;
    > vertical-align: top;
    > }
    > .searchform input.button {
    > width: 60px;
    > height: 24px;
    > padding: 2px 5px;
    > vertical-align: top;
    > }
    >
    > /********************************************
    > LAYOUT
    > ********************************************/
    > #wrapper {
    > margin: 20px auto 0px;
    > width: 980px;
    > position: relative;
    >
    > }
    > #logo {
    > float: left;
    > height: 192px;
    > width: 234px;
    > position: relative;
    > }
    > #header {
    > float: left;
    > height: 192px;
    > width: 745px;
    > position: relative;
    > }
    > #content {
    > float: left;
    > width: 691px;
    > position: relative;
    > background: #FFFFFF url(images/content.jpg) no-repeat;
    > color: #333333;
    > padding: 150px 30px 20px 22px;
    > }
    > #gallery {
    > float: left;
    > height: 200px;
    > width: 116px;
    > position: relative;
    > background: url(images/photogallery.jpg) no-repeat;
    > padding-top: 72px;
    > padding-left: 12px;
    > padding-right: 10px;
    > }
    > #training_photo {
    > float: left;
    > height: 197px;
    > width: 234px;
    > background: url(images/training_photo.jpg) no-repeat;
    > position: relative;
    > clear: both;
    > }
    > #volunteer {
    > float: left;
    > height: 170px;
    > width: 214px;
    > position: relative;
    > background: url(images/volunteer.jpg) no-repeat;
    > padding-top: 27px;
    > padding-left: 20px;
    > color: #333333;
    > }
    > #firetruck {
    > float: left;
    > height: 197px;
    > width: 266px;
    > position: relative;
    > }
    > #training {
    > float: left;
    > height: 197px;
    > width: 245px;
    > position: relative;
    > }
    >
    > /* Navigation */
    > #nav {
    > float: left;
    > height: 272px;
    > width: 234px;
    > position: relative;
    > background: #333333;
    > }
    > #nav ul {
    > float: left;
    > list-style: none;
    > width: 234px;
    > padding: 0;
    > height: 40px;
    > display: inline;
    > text-transform: uppercase;
    > margin: 0 0 0 0px;
    > }
    > #nav ul li {
    > display: inline;
    > margin: 0;
    > padding: 0;
    > }
    > #nav ul li a {
    > display: block;
    > float: left;
    > width: 214px;
    > color: #999999;
    > text-transform: capitalize;
    > text-decoration: none;
    > font: normal 13px/38px Georgia, "Times New Roman",
    Times, serif;
    > margin: 0;
    > padding-left: 20px;
    > border-bottom: 1px solid #666666;
    > }
    > #nav ul li a:hover,
    > #nav ul li a:active {
    > color: #FFFFFF;
    > }
    > #nav ul li#current a {
    > background: #DBDBDB url(nav-current.jpg) repeat-x;
    >
    > /* footer */
    > }
    > #footer {
    > float: left;
    > height: 50px;
    > width: 980px;
    > position: relative;
    > text-align: right;
    > margin: 0px;
    > padding: 0px;
    > color: #333333;
    > font: 11px/1.5em Georgia, "Times New Roman", Times,
    serif;
    >

  • Help Creating a Graph (of sorts) for Professional Driver Daily Logs

    Hey All!
    I'm working on a project for myself, that could go commercial if it gets as good as I'm hoping it will. This application (which I'm calling Truck Manager) will manage income and expenses, help plan trips, track trip/load information and do the US-MCSA/DOT regulated Driver's Daily Log. This log is a line graph that runs from midnight to midnight and has four lines: (1) Off Duty; (2) Sleeper Berth; (3) On Duty, Driving; and (4) On Duty, Not Driving. If anyone needs to see a paper form of this log book, just ask and I'll scan in one of my copies and post.
    Anyway, I'm using J2D to handle the log book "pages" and have already gotten the grid laid out just fine...it runs from midnight to midnight and is broken into 15-minute increments, with the four required lines described above. Now that I have that done, I've hit a logic block that is keeping me from figuring out the best and/or simplest way to log the status changes and time lines. For example, let's say that I work the following day:
    Midnight until 06:00 == off duty
    06:00 until 06:15 == on duty, not driving: performing pre-trip inspection
    06:15 until 08:00 == on duty, driving to customer to be loaded
    08:00 until 08:15 == on duty, not driving: being loaded (only required to log 15 minutes for this)
    08:15 until 09:00 == off duty (still being loaded)
    09:00 until 12:00 == on duty, driving (heading toward delivery)
    12:00 until 12:45 == off duty (lunch)
    12:45 until 15:00 == on duty, driving (heading toward delivery)
    15:00 until 15:15 == on duty, not driving (being unloaded)
    15:15 until 16:00 == off duty, (still being unloaded)
    16:00 until 20:00 == on duty, driving (heading home)
    20:00 until midnight == sleeper (ran out of hours)
    This graph would look like the following (provided each dash represents one 15-minute block:
    <pre>
    1. -----------------------| |---| |---| |---|
    2. | | | | | | | |----------------
    3. | -------| | |------------| |---------| | |----------------|
    4. |-| |-| |-|
    </pre>
    Though the above graph is crappy, it should give the idea of what needs to be done. At each change of status (i.e., from off duty to on duty, not driving) there must be a vertical line between the statuses, not going above and below like in the example above. Then, once the status changes again, the horizontal line needs to be drawn from the vertical line of the last status change to the time of the new status change and then the vertical line to the new status.
    The way the driver's daily log works is like this...When I come on duty, I am required to do a pre-trip inspection of my truck/trailer, which requires 15 minutes on duty, not driving, so I log that all at once, including the vertical line up to the 3rd line of the graph, which is on duty, driving. Then, in this example, I drive for 1.75 hours, until I arrive at my pick-up. Once I get there, I draw the horizontal line on line 3 of the graph, the vertical line down to line 4 (on duty, not driving), the 15-minute horizontal line and the vertical line up to line 1 (off duty). When I get ready to leave the pick-up after I am loaded, I draw the horizontal line across line 1, the vertical line down to line 3 and then drive until I stop.
    Other things that are desired for this graph logic is to take into account the US-MCSA/DOT regulations for drivers that state the following:
    a. A driver may not be on duty for more than 14 hours, without a 10-hour break
    - Nothing stops this "14-hour clock" except a 10-hour break, so if a driver comes on duty at 06:00 and spends 15 minutes doing the pre-trip inspection and then goes off duty for the next 8 hours, the 14-hour clock is still running and the driver will only have 5 hours and 45 minutes to work (roughly).
    b. A driver may not drive for more than 11 hours, without a 10-hour break, provided the 14-hour rule is obeyed.
    - In other words, even if a driver only drives for a total of 7 hours, but the 14-hour clock expires, the driver may not complete his/her 11 hours of driving allowed.
    c. A driver must take a break of 10 consecutive hours in each 24-hour period.
    *** This is confusing because the 10-hour break can span midnight and still be considered consecutive, even though part of the break is on one graph and the other part is on another graph.
    In taking these rules into account, I would like the graphing part of the program's logic to change the horizontal line color from blue (the regular line color) to red if the driver is in violation of the rules above. Where this gets really complicated is where the same status crosses midnight from day-to-day.
    As I said, I have successfully gotten the grid painted using java.awt.Graphics2D methods, but am having trouble coming up with the logic for drawing the driver status throughout the day. All data will be stored in a MySQL database table and can be pulled at any time that it is needed. The user will be entering the current status change time, as well as location (city and state) and a comment (which is not required, except for when doing a pre-trip inspection, fueling, loading or unloading), then clicking a button labeled "Update Log".
    Any help with the logic for this part of the application is greatly appreciated. If you can provide sample code to help demonstrate the logic you are describing, I will be grateful.
    Thank you all for your assistance. If you would like a better idea of what the daily log graph looks like, you can run the class below.
    Cheers,
    Sean
    <pre>
    * DriverLog.java: Driver's Daily Log entry screen. By completing the small form at the bottom of
    * dialog, the system will automatically update your log.
    * Created on Sep 30, 2010, 2:03:18 PM
    package net.pekinsoft.trkmgr.gui;
    import java.awt.BasicStroke;
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.Point;
    import java.awt.Toolkit;
    * @author Sean Carrick
    public class DriverLog extends javax.swing.JFrame {
    // Private class-level variables.
    * @code{java.awt.Graphics2D} object that we will use for drawing on our
    * view port, which is a @code{javax.swing.JPanel} on our form. This view
    * port will hold our driver's log graph that shows the driver's status at
    * different times of the day based upon the data the driver provides.
    private Graphics2D canvas;
    * @code{java.awt.geom.Point} object to hold the starting x, y coordinates
    * for the driver's daily log off duty line.
    private Point offDutyStartPoint;
    * @code{java.awt.geom.Point} object to hold the ending x, y coordinates
    * for the driver's daily log off duty line.
    private Point offDutyEndingPoint;
    * @code{java.awt.geom.Point} object to hold the starting x, y coordinates
    * for the driver's daily log sleeper berth line.
    private Point sleeperStartPoint;
    * @code{java.awt.geom.Point} object to hold the ending x, y coordinates
    * for the driver's daily log sleeper berth line.
    private Point sleeperEndingPoint;
    * @code{java.awt.geom.Point} object to hold the starting x, y coordinates
    * for the driver's daily log driving line.
    private Point drivingStartPoint;
    * @code{java.awt.geom.Point} object to hold the ending x, y coordinates
    * for the driver's daily log driving line.
    private Point drivingEndingPoint;
    * @code{java.awt.geom.Point} object to hold the start x, y coordinates
    * for the driver's daily log not driving line.
    private Point notDrivingStartPoint;
    * @code{java.awt.geom.Point} object to hold the ending x, y coordinates
    * for the driver's daily log not driving line.
    private Point notDrivingEndingPoint;
    * @code{int} that holds the number of 15-minute blocks in a 24-hour period.
    private static final int qtrHourBlocks = (24 * 60) / 15;
    /** Creates new form DriverLog */
    public DriverLog() {
    // Initialize the window's components. {handled by NetBeans}
    initComponents();
    // Center the window on the screen.
    Toolkit tk = Toolkit.getDefaultToolkit();
    int winX = (tk.getScreenSize().width - getWidth()) / 2;
    int winY = (tk.getScreenSize().height - getHeight()) / 2;
    setLocation(winX, winY);
    // Initialize our drawing canvas.
    canvas = (Graphics2D) viewPort.getGraphics();
    // Next, we need to initialize our line starting and ending point objects.
    int qtr = (viewPort.getHeight() / 8);
    int y = qtr + 20;
    int startX = 20;
    int endX = viewPort.getWidth() - 20;
    offDutyStartPoint = new Point(startX, y);
    offDutyEndingPoint = new Point(endX, y);
    y = (qtr * 2) + 20; // Double the value of y
    sleeperStartPoint = new Point(startX, y);
    sleeperEndingPoint = new Point(endX, y);
    y = (qtr * 3) + 20; // Triple the value of y.
    drivingStartPoint = new Point(startX, y);
    drivingEndingPoint = new Point(endX, y);
    y = (qtr * 4) + 20; // Quadruple the value of y.
    notDrivingStartPoint = new Point(startX, y);
    notDrivingEndingPoint = new Point(endX, y);
    // Now that our objects have been initialized, we need to draw our grid.
    paint();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
    bgrpStatus = new javax.swing.ButtonGroup();
    viewPort = new javax.swing.JPanel();
    lblStatusChange = new javax.swing.JLabel();
    txtStatusChange = new javax.swing.JFormattedTextField();
    rbtnOffDuty = new javax.swing.JRadioButton();
    rbtnSleeper = new javax.swing.JRadioButton();
    rbtnDriving = new javax.swing.JRadioButton();
    rbtnNotDriving = new javax.swing.JRadioButton();
    btnUpdate = new javax.swing.JButton();
    lblComment = new javax.swing.JLabel();
    txtComment = new javax.swing.JTextField();
    lblLocation = new javax.swing.JLabel();
    txtLocation = new javax.swing.JTextField();
    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Driver's Daily Log");
    setAlwaysOnTop(true);
    setResizable(false);
    addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowOpened(java.awt.event.WindowEvent evt) {
    formWindowOpened(evt);
    addWindowStateListener(new java.awt.event.WindowStateListener() {
    public void windowStateChanged(java.awt.event.WindowEvent evt) {
    formWindowStateChanged(evt);
    javax.swing.GroupLayout viewPortLayout = new javax.swing.GroupLayout(viewPort);
    viewPort.setLayout(viewPortLayout);
    viewPortLayout.setHorizontalGroup(
    viewPortLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGap(0, 674, Short.MAX_VALUE)
    viewPortLayout.setVerticalGroup(
    viewPortLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGap(0, 351, Short.MAX_VALUE)
    lblStatusChange.setText("Status Change Time:");
    txtStatusChange.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(
    new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("HH:mm"))));
    bgrpStatus.add(rbtnOffDuty);
    rbtnOffDuty.setSelected(true);
    rbtnOffDuty.setText("Off Duty");
    bgrpStatus.add(rbtnSleeper);
    rbtnSleeper.setText("Sleeper");
    bgrpStatus.add(rbtnDriving);
    rbtnDriving.setText("Driving");
    bgrpStatus.add(rbtnNotDriving);
    rbtnNotDriving.setText("On Duty; Not Driving");
    btnUpdate.setMnemonic('U');
    btnUpdate.setText("Update Driver Log");
    btnUpdate.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btnUpdateActionPerformed(evt);
    lblComment.setText("Reason/Comment:");
    lblLocation.setText("Location: City, ST:");
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(viewPort, javax.swing.GroupLayout.DEFAULT_SIZE,
    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(lblLocation)
    .addComponent(lblStatusChange))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addGroup(layout.createSequentialGroup()
    .addComponent(txtStatusChange, javax.swing.GroupLayout.PREFERRED_SIZE, 50,
    javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGap(18, 18, 18)
    .addComponent(rbtnOffDuty)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(rbtnSleeper)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(rbtnDriving)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(rbtnNotDriving)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
    65, Short.MAX_VALUE)
    .addComponent(btnUpdate))
    .addGroup(layout.createSequentialGroup()
    .addComponent(txtLocation, javax.swing.GroupLayout.DEFAULT_SIZE,
    232, Short.MAX_VALUE)
    .addGap(18, 18, 18)
    .addComponent(lblComment)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(txtComment, javax.swing.GroupLayout.PREFERRED_SIZE,
    227, javax.swing.GroupLayout.PREFERRED_SIZE)))))
    .addContainerGap())
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(viewPort, javax.swing.GroupLayout.DEFAULT_SIZE,
    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addGap(18, 18, 18)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(lblStatusChange)
    .addComponent(txtStatusChange, javax.swing.GroupLayout.PREFERRED_SIZE,
    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(rbtnOffDuty)
    .addComponent(rbtnSleeper)
    .addComponent(rbtnDriving)
    .addComponent(rbtnNotDriving)
    .addComponent(btnUpdate))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(txtComment, javax.swing.GroupLayout.PREFERRED_SIZE,
    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(lblComment)
    .addComponent(lblLocation)
    .addComponent(txtLocation, javax.swing.GroupLayout.PREFERRED_SIZE,
    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addContainerGap())
    pack();
    }// </editor-fold>
    private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {                                         
    // KEEP AS LAST LINE IN THIS FUNCTION!!! //
    paint();
    private void formWindowStateChanged(java.awt.event.WindowEvent evt) {                                       
    // Draw the driver's daily log grid.
    paint();
    private void formWindowOpened(java.awt.event.WindowEvent evt) {                                 
    // Draw the driver's daily log grid.
    paint();
    private void paint() {
    drawOutline();
    * @code{net.pekinsoft.gui.DriverLog.drawOutline()} function handles the
    * rendering of the driver's daily log grid outline only.
    private void drawOutline() {
    // Set up the starting point for our log grid's upper-left corner.
    int x = 0; // 20 points down from the top.
    int y = 0; // 20 points in from the left.
    int offset = 28;
    // Get the height and width of our log grid from the panel.
    int h = 112;
    int w = 671;
    // Set the color of our border to Red.
    canvas.setStroke(new BasicStroke(1));
    canvas.setPaint(Color.BLACK);
    // Draw our log graph outline.
    canvas.drawRect(x, y, w, h);
    // Draw our log's horizontal lines.
    for ( int i = 1; i < 5; i++ ) {
    canvas.drawLine(x, y + (i * offset), w + offset, y + (i * offset));
    // Draw our log's hour lines.
    for ( int i = 1; i < 24; i++ ) {
    canvas.drawLine(x + (i * offset), 0, x + (i * offset), 112);
    // Draw our log's 30-minute ticks.
    for ( int i = 1; i < 48; i++ ) {
    for ( int j = 0; j < 5; j++ ) {
    canvas.drawLine(x + (i * (offset / 2)), y + (j * offset),
    x + (i * (offset / 2)), (y + (j * offset) + 10));
    // Draw our log's 15-minute ticks.
    for ( int i = 1; i < 96; i++ ) {
    for ( int j = 0; j < 5; j++ ) {
    canvas.drawLine(x + (i * (offset / 4)), y + (j * offset),
    x + (i * (offset / 4)), (y + (j * offset) + 5));
    canvas.drawLine(0, 112, 0, 122);
    canvas.drawLine(w, 112, w, 122);
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new DriverLog().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.ButtonGroup bgrpStatus;
    private javax.swing.JButton btnUpdate;
    private javax.swing.JLabel lblComment;
    private javax.swing.JLabel lblLocation;
    private javax.swing.JLabel lblStatusChange;
    private javax.swing.JRadioButton rbtnDriving;
    private javax.swing.JRadioButton rbtnNotDriving;
    private javax.swing.JRadioButton rbtnOffDuty;
    private javax.swing.JRadioButton rbtnSleeper;
    private javax.swing.JTextField txtComment;
    private javax.swing.JTextField txtLocation;
    private javax.swing.JFormattedTextField txtStatusChange;
    private javax.swing.JPanel viewPort;
    // End of variables declaration
    </pre>
    Edited by: 799477 on Oct 1, 2010 2:42 PM

    <blockquote>Sean, I checked your code and seen that package net.pekinsoft..., is this an Illinois Company by any chance?</blockquote>
    Yes, this is a company that I have tried (unsuccessfully) to start in central Illinois...I'm guessing that the "Pekin" part gave it away.
    <blockquote>Thanks for posting the DB TABLE -- we'll need that later, plus I wanted to see if you would respond.</blockquote>
    Not a problem on the DB table. Why wouldn't I respond...I want and NEED help here... ;-)
    <blockquote>I have a few questions but don't want to complicate your line of thinking, so I'll just describe generally how I have approached a big project like this. </blockquote>
    I will answer them the best that I can.
    <blockquote>For one thing, I do not start with a GUI or even consider what I want it to look like... I start with the data, and how that data is broken down into different classes, and then how those classes come together to form an Object Hierarchy. I have and do maintain a large MySQL database myself with 18 TABLES. Some of the TABLES hold very little information which I use as static final information. As a matter of fact, one of those TABLES is called status and contains 5 fields. This status TABLE is storing 7 rows of information because I have 7 different levels. The fields in my status TABLE are status_id, status_type, status_title, status_desc, and status_icon. This means I will have 7 icons to represent the different status levels, a description, a title, a type (maybe yours could be ON or OFF duty for example), and the ID of the status.
    Another thing at this stage of development is that I don't make up my mind concretely about any of the data or how the data will fit together. I want to remain as flexible as possible, so that as my design develops, the design allows for the addition or subtraction of data and different data types to be created. In other words, I completely atomize all structure, associations, relationships, dependencies, or just anything in general that makes two or more pieces of information stick together.
    At this point, all I have is a loose bag of primitive data types with no structure whatsoever. Like I just tore up a piece of paper into a hundred pieces and threw into the air letting the pieces fall where they may.
    While I'm at this point, I will make decisions about which languages and platform would be the best to raise the beast. In my case, I chose to run it on the internet, so I chose MySQL to store the data, SQL to communicate to the DB, and the server uses a PHP scripting engine to spit out the HTML, also PHP lets me create OO classes very similar to a JAVA class. This is a very important step and must be made now, not later -- you don't want to do all this work only to find out that it should have been done in another language! Been there done that.
    Once I've decided all of the above, then I come back and decide how the data should be organized. NOW I make all the database TABLES. Then I write a class definition for each of the db tables. Each class will provide methods for saving, editing, and retrieving info to and from the db using SQL.
    Once I get to this point I will make FORMS for the easy entry of data. The FORMS, CLASSES and and db TABLES all mirror each other now, so the CLASSES handle all the info from FORM to DB, DB to FORM. Notice at this point I am still dealing with data and data flow, NOT the display of pretty information -- not even close.
    Ok, enough about this Sean, let me know if this helps any.</blockquote>
    This information was helpful, but also how I typically approach a large project.
    The only problem with what you talk about above is dealing with allowing "wiggle-room" for changing the data because the data that I'm storing is codified by the federal government through the CSA-2010 laws that regulate the trucking industry. Therefore, I really don't have any wiggle-room with the data at all.
    As for choosing Java over another language, I made this choice because I don't like limiting myself (or others) on what operating system they use and platform-independence is one of the best things about Java (provided you don't use any OS-specific code, which I try like hell not to do). I am a huge Linux guy, but have to use Windows to update my GPS and would like to be able to use this application no matter which OS I'm booted into. Just so you understand, I am fluent in multiple languages, including PHP, Java, Python, Ruby, C/C++, BASIC and Bash. I am also very big on OOP and always leave accessing the database to the class that holds that data (i.e., LogEntry class will access the database to store and retrieve the log data). I am also using MySQL as the database back-end, because it is the SQL server that I am most comfortable with and also has versions for various OSes. I use the mysql-connector.jar library for accessing MySQL from Java, so that's not even an issue.
    As for "static final" data in the database, I do store my statuses, with the status_id numbers the same as the row number on the hard-copy Driver's Daily Log books. These records simply hold the status_id and description (i.e., 1, "Off Duty").
    I believe that I've got the logic for logging an entry such as: 08:00-10:00, On Duty, Driving, status location Indianapolis, IN, comment: Tire check. This whole entry is on the same day and therefore fairly easy to graph. The type of entry that I'm having problems figuring the logic for is one where the last change of duty status was before midnight and the current change of duty status is after midnight, on the next day. For example, I typically stop for the night (my DOT 10-hour break) at 5:00 PM (17:00) and am in the sleeper across midnight, then get going at 3:00 AM (03:00). I'm having trouble figuring out how many hours to log on the current day. In the example that I just gave, I'm not getting how I can figure out when to start at midnight and when to start out at the prior status change time through code. Nothing that I try seems to work correctly and I keep getting horizontal status lines outside of my graph area.
    As for what data I need to store and how I need to store it, I am very flexible, except with the daily log data, since it is federally mandated. Once I figure out the logic for actually logging the statuses and changes of status properly, I will create the class for storing and retrieving the database data...for now I'm just using hard-coded times to get the graphing logic right without the overhead of database access. Changing this code to use the data from the database will be a snap in comparison to figuring out the graphing functionality.
    Thanks for your insights and assistance. I look forward to seeing what other ideas you have to share.
    Sean

  • [Solved] "slim: failed to execute login command" after awesomewm updat

    Hi,
    i updated some weeks ago via pacman -Syu, where also awesome wm was updated from 3.4.* to 3.5.* so I updated my rc.lua as it is told on their wiki, but i cant login with my rc.lua anymore i got the failed to execute login command error from slime. If i use the shipped efault rc.lua it works fine, can someone help me to figure out whats wrong with my rc.lua?
    -- Standard awesome library
    local gears = require("gears")
    local awful = require("awful")
    awful.rules = require("awful.rules")
    require("awful.autofocus")
    -- Widget and layout library
    local wibox = require("wibox")
    -- Theme handling library
    local beautiful = require("beautiful")
    -- Notification library
    local naughty = require("naughty")
    local menubar = require("menubar")
    local vicious = require("vicious")
    function fullscreens(c)
    awful.client.floating.toggle(c)
    if awful.client.floating.get(c) then
    local clientX = screen[1].workarea.x
    local clientY = screen[1].workarea.y
    local clientWidth = 0
    -- look at http://www.rpm.org/api/4.4.2.2/llimits_8h-source.html
    local clientHeight = 2147483640
    for s = 1, screen.count() do
    clientHeight = math.min(clientHeight, screen[s].workarea.height)
    clientWidth = clientWidth + screen[s].workarea.width
    end
    local t = c:geometry({x = clientX, y = clientY, width = clientWidth, height = clientHeight})
    else
    --apply the rules to this client so he can return to the right tag if there is a rule for that.
    awful.rules.apply(c)
    end
    -- focus our client
    client.focus = c
    end
    -- {{{ Error handling
    -- Check if awesome encountered an error during startup and fell back to
    -- another config (This code will only ever execute for the fallback config)
    if awesome.startup_errors then
    naughty.notify({ preset = naughty.config.presets.critical,
    title = "Oops, there were errors during startup!",
    text = awesome.startup_errors })
    end
    -- Handle runtime errors after startup
    do
    local in_error = false
    awesome.connect_signal("debug::error", function (err)
    -- Make sure we don't go into an endless error loop
    if in_error then return end
    in_error = true
    naughty.notify({ preset = naughty.config.presets.critical,
    title = "Oops, an error happened!",
    text = err })
    in_error = false
    end)
    end
    -- {{{ Variable definitions
    -- Themes define colours, icons, and wallpapers
    -- beautiful.init("/home/kili/Repositories/awesome-themes/arch/theme.lua")
    beautiful.init("/usr/share/awesome/themes/default/theme.lua")
    -- This is used later as the default terminal and editor to run.
    terminal = "urxvt"
    editor = os.getenv("EDITOR") or "nano"
    editor_cmd = terminal .. " -e " .. editor
    -- Default modkey.
    -- Usually, Mod4 is the key with a logo between Control and Alt.
    -- If you do not like this or do not have such a key,
    -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
    -- However, you can use another modifier like Mod1, but it may interact with others.
    modkey = "Mod4"
    -- Table of layouts to cover with awful.layout.inc, order matters.
    layouts =
    awful.layout.suit.tile,
    awful.layout.suit.tile.left,
    awful.layout.suit.tile.bottom,
    awful.layout.suit.tile.top,
    awful.layout.suit.floating,
    awful.layout.suit.fair,
    awful.layout.suit.fair.horizontal,
    awful.layout.suit.spiral,
    awful.layout.suit.spiral.dwindle,
    awful.layout.suit.max,
    awful.layout.suit.max.fullscreen,
    awful.layout.suit.magnifier
    -- {{{ Tags
    -- Define a tag table which hold all screen tags.
    tags = {}
    for s = 1, screen.count() do
    -- Each screen has its own tag table.
    tags[s] = awful.tag({ 1, 2, 3, 4, 5}, s, layouts[1])
    end
    -- {{{ Menu
    -- Create a laucher widget and a main menu
    myawesomemenu = {
    { "manual", terminal .. " -e man awesome" },
    { "edit config", editor_cmd .. " " .. awesome.conffile },
    { "restart", awesome.restart },
    { "quit", awesome.quit }
    mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
    { "open terminal", terminal }
    mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu })
    -- {{{ Wibox
    -- Create a textclock widget
    batwidget = wibox.widget.textbox()
    vicious.register(batwidget, vicious.widgets.bat,
    function(widget,args)
    local formatstring = " Bat: "..args[1]..args[2] .."%".. " "..args[3] .. " "
    if args[2] <= 25 and args[1] == "-" then
    return "<span color=\"red\">".. formatstring .. "</span>"
    end
    return formatstring
    end, 60, "BAT0")
    netwidgetETH = wibox.widget.textbox()
    netwidgetWIFI = wibox.widget.textbox()
    vicious.register(netwidgetETH, vicious.widgets.net, ' eth0:<span color="#CC9393">${eth0 down_kb}</span> <span color="#7F9F7F">${eth0 up_kb}</span>', 3)
    vicious.register(netwidgetWIFI, vicious.widgets.net,' wlan0:<span color="#CC9393">${wlan0 down_kb}</span> <span color="#7F9F7F">${wlan0 up_kb}</span>', 3)
    menubar.utils.terminal = terminal
    mytextclock = awful.widget.textclock()--{ align = "right" })
    -- Create a systray
    mysystray = wibox.widget.systray()
    -- Create a wibox for each screen and add it
    mywibox = {}
    mypromptbox = {}
    mylayoutbox = {}
    mytaglist = {}
    mytaglist.buttons = awful.util.table.join(
    awful.button({ }, 1, awful.tag.viewonly),
    awful.button({ modkey }, 1, awful.client.movetotag),
    awful.button({ }, 3, awful.tag.viewtoggle),
    awful.button({ modkey }, 3, awful.client.toggletag),
    awful.button({ }, 4, function(t) awful.tag.viewnext(aweful.tag.getscreen(t)) end),
    awful.button({ }, 5, function(t) awful.tag.viewprev(aweful.tag.getscreen(t)) end)
    mytasklist = {}
    mytasklist.buttons = awful.util.table.join(
    awful.button({ }, 1, function (c)
    if c == client.focus then
    c.minimized = true
    else
    c.minimized = false
    if not c:isvisible() then
    awful.tag.viewonly(c:tags()[1])
    end
    -- This will also un-minimize
    -- the client, if needed
    client.focus = c
    c:raise()
    end
    end),
    awful.button({ }, 3, function ()
    if instance then
    instance:hide()
    instance = nil
    else
    instance = awful.menu.clients({ width=250 })
    end
    end),
    awful.button({ }, 4, function ()
    awful.client.focus.byidx(1)
    if client.focus then client.focus:raise() end
    end),
    awful.button({ }, 5, function ()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end))
    for s = 1, screen.count() do
    -- Create a promptbox for each screen
    mypromptbox[s] = awful.widget.prompt()--{ layout = awful.widget.layout.horizontal.leftright })
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    mylayoutbox[s] = awful.widget.layoutbox(s)
    mylayoutbox[s]:buttons(awful.util.table.join(
    awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
    awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
    awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
    awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
    -- Create a taglist widget
    mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
    -- Create a tasklist widget
    mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
    -- Create the wibox
    mywibox[s] = awful.wibox({ position = "top", screen = s })
    -- Widgets that are aligned to the left
    local left_layout = wibox.layout.fixed.horizontal()
    left_layout:add(mylauncher)
    left_layout:add(mytaglist[s])
    left_layout:add(mypromptbox[s])
    -- Widgets that are aligned to the right
    local right_layout = wibox.layout.fixed.horizontal()
    if s == 1 then right_layout:add(wibox.widget.systray()) end
    right_layout:add(netwidgetWIFI)
    right_layout:add(netwidgetETH)
    right_layout:add(batwidget)
    right_layout:add(mytextclock)
    right_layout:add(mylayoutbox[s])
    -- Now bring it all together (with the tasklist in the middle)
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    layout:set_middle(mytasklist[s])
    layout:set_right(right_layout)
    mywibox[s]:set_widget(layout)
    -- Add widgets to the wibox - order matters
    --mywibox[s].widgets = {
    -- mylauncher,
    -- mytaglist[s],
    -- mypromptbox[s],
    --layout = awful.widget.layout.horizontal.leftright
    -- mylayoutbox[s],
    -- mytextclock,
    -- batwidget,
    -- netwidgetETH,
    -- netwidgetWIFI,
    -- s == 1 and mysystray or nil,
    -- mytasklist[s],
    -- layout = awful.widget.layout.horizontal.rightleft
    end
    -- {{{ Mouse bindings
    root.buttons(awful.util.table.join(
    awful.button({ }, 3, function () mymainmenu:toggle() end),
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev)
    -- {{{ Key bindings
    globalkeys = awful.util.table.join(
    awful.key({ modkey, }, "Left", awful.tag.viewprev ),
    awful.key({ modkey, }, "Right", awful.tag.viewnext ),
    awful.key({ modkey, }, "Escape", awful.tag.history.restore),
    awful.key({ modkey, }, "j",
    function ()
    awful.client.focus.byidx( 1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey, }, "k",
    function ()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey, }, "w", function () mymainmenu:show() end),
    -- Layout manipulation
    awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
    awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
    awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
    awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
    awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
    awful.key({ modkey, }, "Tab",
    function ()
    awful.client.focus.history.previous()
    if client.focus then
    client.focus:raise()
    end
    end),
    -- Standard program
    awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
    awful.key({ modkey, "Control" }, "r", awesome.restart),
    awful.key({ modkey, "Shift" }, "q", awesome.quit),
    awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
    awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
    awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
    awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
    awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
    awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
    awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
    awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
    awful.key({ modkey, "Control" }, "n", awful.client.restore),
    -- Prompt
    awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
    awful.key({ modkey }, "x",
    function ()
    awful.prompt.run({ prompt = "Run Lua code: " },
    mypromptbox[mouse.screen].widget,
    awful.util.eval, nil,
    awful.util.getdir("cache") .. "/history_eval")
    end),
    -- Multimedia
    awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer -q sset Master 2dB-") end),
    awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer -q sset Master 2dB+") end),
    awful.key({ }, "XF86AudioNext",function () awful.util.spawn( "mocp -f" ) end),
    awful.key({ }, "XF86AudioPrev",function () awful.util.spawn( "mocp -r" ) end),
    awful.key({ }, "XF86AudioPlay",function () awful.util.spawn( "mocp -G" ) end),
    awful.key({ }, "Print", function () awful.util.spawn("ksnapshot") end),
    awful.key({ }, "", function () awful.util.spawn("slimlock") end)
    clientkeys = awful.util.table.join(
    awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
    awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
    awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
    awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
    awful.key({ modkey, }, "o", awful.client.movetoscreen ),
    -- awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
    awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
    awful.key({ modkey, }, "n",
    function (c)
    -- The client currently has the input focus, so it cannot be
    -- minimized, since minimized clients can't have the focus.
    c.minimized = true
    end),
    awful.key({ modkey, }, "m",
    function (c)
    c.maximized_horizontal = not c.maximized_horizontal
    c.maximized_vertical = not c.maximized_vertical
    end),
    awful.key({ modkey, "Shift" }, "f", fullscreens)
    -- Compute the maximum number of digit we need, limited to 9
    keynumber = 0
    for s = 1, screen.count() do
    keynumber = math.min(9, math.max(#tags[s], keynumber))
    end
    -- Bind all key numbers to tags.
    -- Be careful: we use keycodes to make it works on any keyboard layout.
    -- This should map on the top row of your keyboard, usually 1 to 9.
    for i = 1, keynumber do
    globalkeys = awful.util.table.join(globalkeys,
    awful.key({ modkey }, "#" .. i + 9,
    function ()
    local screen = mouse.screen
    if tags[screen][i] then
    awful.tag.viewonly(tags[screen][i])
    end
    end),
    awful.key({ modkey, "Control" }, "#" .. i + 9,
    function ()
    local screen = mouse.screen
    if tags[screen][i] then
    awful.tag.viewtoggle(tags[screen][i])
    end
    end),
    awful.key({ modkey, "Shift" }, "#" .. i + 9,
    function ()
    if client.focus and tags[client.focus.screen][i] then
    awful.client.movetotag(tags[client.focus.screen][i])
    end
    end),
    awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
    function ()
    if client.focus and tags[client.focus.screen][i] then
    awful.client.toggletag(tags[client.focus.screen][i])
    end
    end))
    end
    clientbuttons = awful.util.table.join(
    awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
    awful.button({ modkey }, 1, awful.mouse.client.move),
    awful.button({ modkey }, 3, awful.mouse.client.resize))
    -- Set keys
    root.keys(globalkeys)
    -- Set Firefox to always map on tags number 2 of screen 1.
    -- { rule = { class = "Firefox" },
    -- properties = { tag = tags[1][2] } },
    -- {{{ Rules
    if screen.count() > 1 then
    awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
    properties = { border_width = beautiful.border_width,
    -- border_color = beautiful.border_normal,
    focus = true,
    keys = clientkeys,
    buttons = clientbuttons } },
    { rule = { class = "MPlayer" },
    properties = { floating = true } },
    { rule = { class = "gimp" },
    properties = { floating = true } },
    { rule = { class = "Xdialog" },
    properties = { floating = true } },
    { rule = { class = "Firefox" },
    properties = { tag = tags[1][1] } },
    { rule = { name = "Thunderbird" },
    properties = { tag = tags[1][2] } },
    { rule = { instance = "plugin-container" },
    properties = { floating = true } },
    { rule = { class = "Luakit" },
    properties = { floating = true } }
    else
    awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
    properties = { border_width = beautiful.border_width,
    -- border_color = beautiful.border_normal,
    focus = true,
    keys = clientkeys,
    buttons = clientbuttons } },
    { rule = { class = "MPlayer" },
    properties = { floating = true } },
    { rule = { class = "gimp" },
    properties = { floating = true } },
    { rule = { class = "Firefox" },
    properties = { tag = tags[1][2] } },
    { rule = { name = "Thunderbird" },
    properties = { tag = tags[1][3] } },
    { rule = { instance = "plugin-container" },
    properties = { floating = true, fullscreen = true } },
    { rule = { class = "Dolphin" },
    properties = { floating = false, fullscreen = false, tag = tags[1][4] } },
    { rule = { class = "Luakit" },
    properties = { floating = true } },
    { rule = { class = "Pidgin" },
    properties = { tag = tags[1][5] } }
    end
    -- {{{ Signals
    -- Signal function to execute when a new client appears.
    client.connect_signal("manage", function (c, startup)
    -- Add a titlebar
    -- awful.titlebar.add(c, { modkey = modkey })
    -- Enable sloppy focus
    c:connect_signal("mouse::enter", function(c)
    if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
    and awful.client.focus.filter(c) then
    client.focus = c
    end
    end)
    if not startup then
    -- Set the windows at the slave,
    -- i.e. put it at the end of others instead of setting it master.
    -- awful.client.setslave(c)
    -- Put windows in a smart way, only if they does not set an initial position.
    if not c.size_hints.user_position and not c.size_hints.program_position then
    awful.placement.no_overlap(c)
    awful.placement.no_offscreen(c)
    end
    end
    local titlebars_enabled = false
    if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
    -- Widgets that are aligned to the left
    local left_layout = wibox.layout.fixed.horizontal()
    left_layout:add(awful.titlebar.widget.iconwidget(c))
    -- Widgets that are aligned to the right
    local right_layout = wibox.layout.fixed.horizontal()
    right_layout:add(awful.titlebar.widget.floatingbutton(c))
    right_layout:add(awful.titlebar.widget.maximizedbutton(c))
    right_layout:add(awful.titlebar.widget.stickybutton(c))
    right_layout:add(awful.titlebar.widget.ontopbutton(c))
    right_layout:add(awful.titlebar.widget.closebutton(c))
    -- The title goes in the middle
    local title = awful.titlebar.widget.titlewidget(c)
    title:buttons(awful.util.table.join(
    awful.button({ }, 1, function()
    client.focus = c
    c:raise()
    awful.mouse.client.move(c)
    end),
    awful.button({ }, 3, function()
    client.focus = c
    c:raise()
    awful.mouse.client.resize(c)
    end)
    -- Now bring it all together
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    layout:set_right(right_layout)
    layout:set_middle(title)
    awful.titlebar(c):set_widget(layout)
    end
    end)
    client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
    client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
    Here is also my slime config and my initrc
    ls -lisa .xinitrc
    3276814 4 -rwxr-xr-x ...
    #!/bin/sh
    xrdb -merge ~/.Xresources
    wicd-client --tray &
    exec awesome #>> ~/.cache/awesome/stdout 2>> ~/.cache/awesome/stderr
    # Path, X server and arguments (if needed)
    # Note: -xauth $authfile is automatically appended
    default_path /bin:/usr/bin:/usr/local/bin
    default_xserver /usr/bin/X
    xserver_arguments -nolisten tcp vt07
    # Commands for halt, login, etc.
    halt_cmd /sbin/shutdown -h now
    reboot_cmd /sbin/shutdown -r now
    console_cmd /usr/bin/xterm -C -fg white -bg black +sb -T "Console login" -e /bin/sh -c "/bin/cat /etc/issue; exec /bin/login"
    #suspend_cmd /usr/sbin/suspend
    # Full path to the xauth binary
    xauth_path /usr/bin/xauth
    # Xauth file for server
    authfile /var/run/slim.auth
    # Activate numlock when slim starts. Valid values: on|off
    numlock on
    # Hide the mouse cursor (note: does not work with some WMs).
    # Valid values: true|false
    # hidecursor false
    # This command is executed after a succesful login.
    # you can place the %session and %theme variables
    # to handle launching of specific commands in .xinitrc
    # depending of chosen session and slim theme
    # NOTE: if your system does not have bash you need
    # to adjust the command according to your preferred shell,
    # i.e. for freebsd use:
    # login_cmd exec /bin/sh - ~/.xinitrc %session
    login_cmd exec /bin/bash -login ~/.xinitrc %session
    # Commands executed when starting and exiting a session.
    # They can be used for registering a X11 session with
    # sessreg. You can use the %user variable
    # sessionstart_cmd some command
    # sessionstop_cmd some command
    # Start in daemon mode. Valid values: yes | no
    # Note that this can be overriden by the command line
    # options "-d" and "-nodaemon"
    # daemon yes
    # Available sessions (first one is the default).
    # The current chosen session name is replaced in the login_cmd
    # above, so your login command can handle different sessions.
    # see the xinitrc.sample file shipped with slim sources
    sessions awesome,xfce4,icewm-session,wmaker,blackbox
    # Executed when pressing F11 (requires imagemagick)
    screenshot_cmd import -window root /slim.png
    # welcome message. Available variables: %host, %domain
    welcome_msg Welcome to %host
    # Session message. Prepended to the session name when pressing F1
    # session_msg Session:
    # shutdown / reboot messages
    shutdown_msg The system is halting...
    reboot_msg The system is rebooting...
    # default user, leave blank or remove this line
    # for avoid pre-loading the username.
    default_user kili
    # Focus the password field on start when default_user is set
    # Set to "yes" to enable this feature
    focus_password yes
    # Automatically login the default user (without entering
    # the password. Set to "yes" to enable this feature
    #auto_login no
    # current theme, use comma separated list to specify a set to
    # randomly choose from
    current_theme archlinux-simplyblack
    # Lock file
    lockfile /var/lock/slim.lock
    # Log file
    logfile /var/log/slim.log
    Thanks in advance!
    Edit:
    Besides a lot of other errors the problem was the systray. It was created 2 times, now login works again. I figured that out via enabling logging for awesome in the xinitrc again.
    Last edited by stubb (2013-01-08 23:20:05)

    Hi,
    I have the same kind of issue after updated slim from v1.3.4-4 to v1.3.5-1.
    see my topic  here :
    https://bbs.archlinux.org/viewtopic.php?id=156792
    Last edited by cedricl (2013-01-24 17:16:42)

  • Awesome WM text pointer disappears on tag switch

    Hi,
    I have the following problem. On one tag I keep Atom with some file open. If I use the mouse to click on some other tag and go back to Atom everything is ok. If I use modkey+<num> to switch to another tag and back while the mouse is over the task bar or over the widgets everything is ok. But when I switch the tag again with the keyboard shortcut and go back to Atom while the mouse is somewhere over the clients the text pointer in Atom disappears and I need to click somewhere in the text to make it reappear. And it's really annoying when coding to reach for the mouse every time you change to some other tag and back.
    Here's my rc.lua:
    Dremora Awesome WM config 2.0
    github.com/copycat-killer
    -- {{{ Required libraries
    local gears = require("gears")
    local awful = require("awful")
    awful.rules = require("awful.rules")
    require("awful.autofocus")
    local wibox = require("wibox")
    local beautiful = require("beautiful")
    local naughty = require("naughty")
    local drop = require("scratchdrop")
    local lain = require("lain")
    -- {{{ Error handling
    if awesome.startup_errors then
    naughty.notify({ preset = naughty.config.presets.critical,
    title = "Oops, there were errors during startup!",
    text = awesome.startup_errors })
    end
    do
    local in_error = false
    awesome.connect_signal("debug::error", function (err)
    if in_error then return end
    in_error = true
    naughty.notify({ preset = naughty.config.presets.critical,
    title = "Oops, an error happened!",
    text = err })
    in_error = false
    end)
    end
    -- {{{ Autostart applications
    function run_once(cmd)
    findme = cmd
    firstspace = cmd:find(" ")
    if firstspace then
    findme = cmd:sub(0, firstspace-1)
    end
    awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")")
    end
    run_once("urxvtd")
    run_once("unclutter")
    -- {{{ Variable definitions
    -- localization
    --os.setlocale(os.getenv("LANG"))
    -- beautiful init
    beautiful.init(os.getenv("HOME") .. "/.config/awesome/themes/dremora/theme.lua")
    -- common
    modkey = "Mod4"
    altkey = "Mod1"
    terminal = "xfce4-terminal" or "xterm"
    editor = os.getenv("EDITOR") or "nano" or "vi"
    editor_cmd = terminal .. " -e " .. editor
    -- user defined
    browser = "google-chrome"
    browser2 = "iron"
    gui_editor = "atom"
    -- graphics = "gimp"
    local layouts = {
    awful.layout.suit.floating,
    lain.layout.uselesstile,
    awful.layout.suit.fair,
    lain.layout.uselesstile.left,
    lain.layout.uselesstile.top
    -- {{{ Tags
    tags = {
    names = { "ƀ", "Ƅ", "Ɗ", "ƈ", "ƙ" },
    layout = { layouts[1], layouts[3], layouts[2], layouts[1], layouts[5] }
    for s = 1, screen.count() do
    tags[s] = awful.tag(tags.names, s, tags.layout)
    end
    -- {{{ Wallpaper
    if beautiful.wallpaper then
    for s = 1, screen.count() do
    gears.wallpaper.maximized(beautiful.wallpaper, s, true)
    end
    end
    -- {{{ Menu
    mymainmenu = awful.menu.new({ items = require("menugen").build_menu(),
    theme = { height = 16, width = 130 }})
    -- {{{ Wibox
    markup = lain.util.markup
    white = beautiful.fg_focus
    gray = "#858585"
    -- Textclock
    mytextclock = awful.widget.textclock(markup(gray, " %a")
    .. markup(white, " %d ") .. markup(gray, "%b ") .. markup(white, "%H:%M "))
    -- Calendar
    lain.widgets.calendar:attach(mytextclock, { fg = white })
    --[[ Mail IMAP check
    -- commented because it needs to be set before use
    mailwidget = lain.widgets.imap({
    timeout = 180,
    server = "server",
    mail = "mail",
    password = "keyring get mail",
    settings = function()
    mail_notification_preset.fg = white
    mail = ""
    count = ""
    if mailcount > 0 then
    mail = "Mail "
    count = mailcount .. " "
    end
    widget:set_markup(markup(gray, mail) .. markup(white, count))
    end
    -- MPD
    mpdwidget = lain.widgets.mpd({
    settings = function()
    mpd_notification_preset.fg = white
    artist = mpd_now.artist .. " "
    title = mpd_now.title .. " "
    file = mpd_now.file .. " "
    if mpd_now.state == "pause" then
    file = "mpd paused"
    elseif mpd_now.state == "stop" then
    file = ""
    end
    widget:set_markup(markup(gray, file))
    end
    -- /home fs
    fshome = lain.widgets.fs({
    partition = "/home",
    settings = function()
    fs_notification_preset.fg = white
    fs_header = ""
    fs_p = ""
    if fs_now.used >= 90 then
    fs_header = " Hdd "
    fs_p = fs_now.used
    end
    widget:set_markup(markup(gray, fs_header) .. markup(white, fs_p))
    end
    -- Battery
    batwidget = lain.widgets.bat({
    settings = function()
    bat_header = " Bat "
    bat_p = bat_now.perc .. " "
    if bat_now.status == "Not present" then
    bat_header = ""
    bat_p = ""
    end
    widget:set_markup(markup(gray, bat_header) .. markup(white, bat_p))
    end
    -- ALSA volume
    volumewidget = lain.widgets.alsa({
    settings = function()
    header = " Vol "
    vlevel = volume_now.level
    if volume_now.status == "off" then
    vlevel = vlevel .. "M "
    else
    vlevel = vlevel .. " "
    end
    widget:set_markup(markup(gray, header) .. markup(white, vlevel))
    end
    -- Weather
    yawn = lain.widgets.yawn(123456,
    settings = function()
    yawn_notification_preset.fg = white
    end
    -- Separators
    first = wibox.widget.textbox('<span font="Tamsyn 4"> </span>')
    arrl_pre = wibox.widget.imagebox()
    arrl_pre:set_image(beautiful.arrl_lr_pre)
    arrl_post = wibox.widget.imagebox()
    arrl_post:set_image(beautiful.arrl_lr_post)
    -- Create a wibox for each screen and add it
    mywibox = {}
    mypromptbox = {}
    mylayoutbox = {}
    mytaglist = {}
    mytaglist.buttons = awful.util.table.join(
    awful.button({ }, 1, awful.tag.viewonly),
    awful.button({ modkey }, 1, awful.client.movetotag),
    awful.button({ }, 3, awful.tag.viewtoggle),
    awful.button({ modkey }, 3, awful.client.toggletag),
    awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
    awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
    mytasklist = {}
    mytasklist.buttons = awful.util.table.join(
    awful.button({ }, 1, function (c)
    if c == client.focus then
    c.minimized = true
    else
    -- Without this, the following
    -- :isvisible() makes no sense
    c.minimized = false
    if not c:isvisible() then
    awful.tag.viewonly(c:tags()[1])
    end
    -- This will also un-minimize
    -- the client, if needed
    client.focus = c
    c:raise()
    end
    end),
    awful.button({ }, 3, function ()
    if instance then
    instance:hide()
    instance = nil
    else
    instance = awful.menu.clients({ width=250 })
    end
    end),
    awful.button({ }, 4, function ()
    awful.client.focus.byidx(1)
    if client.focus then client.focus:raise() end
    end),
    awful.button({ }, 5, function ()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end))
    for s = 1, screen.count() do
    -- Create a promptbox for each screen
    mypromptbox[s] = awful.widget.prompt()
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    mylayoutbox[s] = awful.widget.layoutbox(s)
    mylayoutbox[s]:buttons(awful.util.table.join(
    awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
    awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
    awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
    awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
    -- Create a taglist widget
    mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
    -- Create a tasklist widget
    mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
    -- Create the wibox
    mywibox[s] = awful.wibox({ position = "top", screen = s, height = 18 })
    -- Widgets that are aligned to the left
    local left_layout = wibox.layout.fixed.horizontal()
    left_layout:add(first)
    left_layout:add(mytaglist[s])
    left_layout:add(arrl_pre)
    left_layout:add(mylayoutbox[s])
    left_layout:add(arrl_post)
    left_layout:add(mypromptbox[s])
    left_layout:add(first)
    -- Widgets that are aligned to the right
    local right_layout = wibox.layout.fixed.horizontal()
    if s == 1 then right_layout:add(wibox.widget.systray()) end
    right_layout:add(first)
    right_layout:add(mpdwidget)
    --right_layout:add(mailwidget)
    right_layout:add(fshome)
    right_layout:add(batwidget)
    right_layout:add(volumewidget)
    right_layout:add(mytextclock)
    -- Now bring it all together (with the tasklist in the middle)
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    layout:set_middle(mytasklist[s])
    layout:set_right(right_layout)
    mywibox[s]:set_widget(layout)
    end
    -- {{{ Mouse bindings
    root.buttons(awful.util.table.join(
    awful.button({ }, 3, function () mymainmenu:toggle() end),
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev)
    -- {{{ Key bindings
    globalkeys = awful.util.table.join(
    -- Take a screenshot
    -- https://github.com/copycat-killer/dots/blob/master/bin/screenshot
    awful.key({ altkey }, "p", function() os.execute("screenshot") end),
    -- Tag browsing
    awful.key({ modkey }, "Left", awful.tag.viewprev ),
    awful.key({ modkey }, "Right", awful.tag.viewnext ),
    awful.key({ modkey }, "Escape", awful.tag.history.restore),
    -- Non-empty tag browsing
    awful.key({ altkey }, "Left", function () lain.util.tag_view_nonempty(-1) end),
    awful.key({ altkey }, "Right", function () lain.util.tag_view_nonempty(1) end),
    -- Default client focus
    awful.key({ altkey }, "k",
    function ()
    awful.client.focus.byidx( 1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ altkey }, "j",
    function ()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end),
    -- By direction client focus
    awful.key({ modkey }, "j",
    function()
    awful.client.focus.bydirection("down")
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey }, "k",
    function()
    awful.client.focus.bydirection("up")
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey }, "h",
    function()
    awful.client.focus.bydirection("left")
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey }, "l",
    function()
    awful.client.focus.bydirection("right")
    if client.focus then client.focus:raise() end
    end),
    -- Show Menu
    -- awful.key({ modkey }, "w",
    -- function ()
    -- mymainmenu:show({ keygrabber = true })
    -- end),
    -- Show/Hide Wibox
    -- awful.key({ modkey }, "b", function ()
    -- mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
    -- end),
    -- On the fly useless gaps change
    awful.key({ altkey, "Control" }, "=", function () lain.util.useless_gaps_resize(1) end),
    awful.key({ altkey, "Control" }, "-", function () lain.util.useless_gaps_resize(-1) end),
    -- Layout manipulation
    awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
    awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
    awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
    awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
    awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
    awful.key({ modkey, }, "Tab",
    function ()
    awful.client.focus.history.previous()
    if client.focus then
    client.focus:raise()
    end
    end),
    awful.key({ altkey, "Shift" }, "l", function () awful.tag.incmwfact( 0.05) end),
    awful.key({ altkey, "Shift" }, "h", function () awful.tag.incmwfact(-0.05) end),
    awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
    awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
    awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
    awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
    awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
    awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
    awful.key({ modkey, "Control" }, "n", awful.client.restore),
    -- Standard program
    awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
    awful.key({ modkey, "Control" }, "r", awesome.restart),
    awful.key({ modkey, "Shift" }, "q", awesome.quit),
    -- Dropdown terminal
    awful.key({ modkey, }, "z", function () drop(terminal) end),
    -- Widgets popups
    awful.key({ altkey, }, "c", function () lain.widgets.calendar:show(7) end),
    awful.key({ altkey, }, "h", function () fshome.show(7) end),
    awful.key({ altkey, }, "w", function () yawn.show(7) end),
    -- ALSA volume control
    awful.key({ }, "XF86AudioRaiseVolume",
    function ()
    awful.util.spawn(string.format("amixer -c %s set %s 1+", volumewidget.card, volumewidget.channel))
    volumewidget.update()
    end),
    awful.key({ }, "XF86AudioLowerVolume",
    function ()
    awful.util.spawn(string.format("amixer -c %s set %s 1-", volumewidget.card, volumewidget.channel))
    volumewidget.update()
    end),
    awful.key({ }, "XF86AudioMute",
    function ()
    awful.util.spawn(string.format("amixer -c %s set %s toggle", volumewidget.card, volumewidget.channel))
    --awful.util.spawn(string.format("amixer set %s toggle", volumewidget.channel))
    volumewidget.update()
    end),
    awful.key({ altkey, "Control" }, "m",
    function ()
    awful.util.spawn(string.format("amixer -c %s set %s 100%%", volumewidget.card, volumewidget.channel))
    volumewidget.update()
    end),
    -- MPD control
    awful.key({ }, "XF86AudioPlay",
    function ()
    awful.util.spawn_with_shell("mpc toggle || ncmpc toggle || pms toggle")
    mpdwidget.update()
    end),
    awful.key({ }, "XF86AudioStop",
    function ()
    awful.util.spawn_with_shell("mpc stop || ncmpc stop || pms stop")
    mpdwidget.update()
    end),
    awful.key({ }, "XF86AudioPrev",
    function ()
    awful.util.spawn_with_shell("mpc prev || ncmpc prev || pms prev")
    mpdwidget.update()
    end),
    awful.key({ }, "XF86AudioNext",
    function ()
    awful.util.spawn_with_shell("mpc next || ncmpc next || pms next")
    mpdwidget.update()
    end),
    -- Copy to clipboard
    awful.key({ modkey }, "c", function () os.execute("xsel -p -o | xsel -i -b") end),
    -- User programs
    awful.key({ modkey }, "w", function () awful.util.spawn(browser) end),
    awful.key({ modkey }, "s", function () awful.util.spawn(gui_editor) end),
    awful.key({ modkey }, "g", function () awful.util.spawn(graphics) end),
    awful.key({ modkey }, "e", function () awful.util.spawn("thunar") end),
    -- Prompt
    awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
    awful.key({ modkey }, "x",
    function ()
    awful.prompt.run({ prompt = "Run Lua code: " },
    mypromptbox[mouse.screen].widget,
    awful.util.eval, nil,
    awful.util.getdir("cache") .. "/history_eval")
    end),
    -- {{ Configures Keymap }} --
    awful.key({ "Control", "Shift" }, "k",
    function()
    awful.util.spawn("xmodmap /home/peio/.Xmodmap_Internal")
    naughty.notify({ timeout = 8, text = "Keyboard configured for internal." })
    end),
    awful.key({ "Control", "Shift" }, "l",
    function()
    awful.util.spawn("xmodmap /home/peio/.Xmodmap_External")
    naughty.notify({ timeout = 8, text = "Keyboard configured for external." })
    end)
    clientkeys = awful.util.table.join(
    awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
    awful.key({ modkey, }, "q", function (c) c:kill() end),
    awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
    awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
    awful.key({ modkey, }, "o", awful.client.movetoscreen ),
    awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
    awful.key({ modkey, }, "n",
    function (c)
    -- The client currently has the input focus, so it cannot be
    -- minimized, since minimized clients can't have the focus.
    c.minimized = true
    end),
    awful.key({ modkey, }, "m",
    function (c)
    c.maximized_horizontal = not c.maximized_horizontal
    c.maximized_vertical = not c.maximized_vertical
    end)
    -- Bind all key numbers to tags.
    -- Be careful: we use keycodes to make it works on any keyboard layout.
    -- This should map on the top row of your keyboard, usually 1 to 9.
    for i = 1, 9 do
    globalkeys = awful.util.table.join(globalkeys,
    awful.key({ modkey }, "#" .. i + 9,
    function ()
    local screen = mouse.screen
    local tag = awful.tag.gettags(screen)[i]
    if tag then
    awful.tag.viewonly(tag)
    end
    end),
    awful.key({ modkey, "Control" }, "#" .. i + 9,
    function ()
    local screen = mouse.screen
    local tag = awful.tag.gettags(screen)[i]
    if tag then
    awful.tag.viewtoggle(tag)
    end
    end),
    awful.key({ modkey, "Shift" }, "#" .. i + 9,
    function ()
    local tag = awful.tag.gettags(client.focus.screen)[i]
    if client.focus and tag then
    awful.client.movetotag(tag)
    end
    end),
    awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
    function ()
    local tag = awful.tag.gettags(client.focus.screen)[i]
    if client.focus and tag then
    awful.client.toggletag(tag)
    end
    end))
    end
    clientbuttons = awful.util.table.join(
    awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
    awful.button({ modkey }, 1, awful.mouse.client.move),
    awful.button({ modkey }, 3, awful.mouse.client.resize))
    -- Set keys
    root.keys(globalkeys)
    -- {{{ Rules
    awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
    properties = { border_width = beautiful.border_width,
    border_color = beautiful.border_normal,
    focus = awful.client.focus.filter,
    keys = clientkeys,
    buttons = clientbuttons,
    size_hints_honor = false } },
    { rule = { class = "URxvt" },
    properties = { opacity = 0.99 } },
    { rule = { class = "MPlayer" },
    properties = { floating = true } },
    { rule = { class = "Dwb" },
    properties = { tag = tags[1][1] } },
    { rule = { class = "Iron" },
    properties = { tag = tags[1][1] } },
    { rule = { instance = "plugin-container" },
    properties = { tag = tags[1][1] } },
    { rule = { class = "Gimp" },
    properties = { tag = tags[1][4] } },
    { rule = { class = "Gimp", role = "gimp-image-window" },
    properties = { maximized_horizontal = true,
    maximized_vertical = true } },
    -- {{{ Signals
    -- Signal function to execute when a new client appears.
    client.connect_signal("manage", function (c, startup)
    -- Enable sloppy focus
    c:connect_signal("mouse::enter", function(c)
    if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
    and awful.client.focus.filter(c) then
    client.focus = c
    end
    end)
    if not startup and not c.size_hints.user_position
    and not c.size_hints.program_position then
    awful.placement.no_overlap(c)
    awful.placement.no_offscreen(c)
    end
    local titlebars_enabled = false
    if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
    -- buttons for the titlebar
    local buttons = awful.util.table.join(
    awful.button({ }, 1, function()
    client.focus = c
    c:raise()
    awful.mouse.client.move(c)
    end),
    awful.button({ }, 3, function()
    client.focus = c
    c:raise()
    awful.mouse.client.resize(c)
    end)
    -- Title in the middle
    local middle_layout = wibox.layout.flex.horizontal()
    local title = awful.titlebar.widget.titlewidget(c)
    title:set_align("center")
    middle_layout:add(title)
    middle_layout:buttons(buttons)
    local layout = wibox.layout.align.horizontal()
    layout:set_middle(middle_layout)
    awful.titlebar(c,{size=18}):set_widget(layout)
    end
    end)
    -- No border for maximized clients
    client.connect_signal("focus",
    function(c)
    if c.maximized_horizontal == true and c.maximized_vertical == true then
    c.border_color = beautiful.border_normal
    else
    c.border_color = beautiful.border_focus
    end
    end)
    client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
    -- {{{ Arrange signal handler
    for s = 1, screen.count() do screen[s]:connect_signal("arrange", function ()
    local clients = awful.client.visible(s)
    local layout = awful.layout.getname(awful.layout.get(s))
    if #clients > 0 then -- Fine grained borders and floaters control
    for _, c in pairs(clients) do -- Floaters always have borders
    if awful.client.floating.get(c) or layout == "floating" then
    c.border_width = beautiful.border_width
    -- No borders with only one visible client
    elseif #clients == 1 or layout == "max" then
    clients[1].border_width = 0
    else
    c.border_width = beautiful.border_width
    end
    end
    end
    end)
    end
    function run_once(cmd)
    findme = cmd
    firstspace = cmd:find(" ")
    if firstspace then
    findme = cmd:sub(0, firstspace-1)
    end
    awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")")
    end
    run_once("nm-applet")
    If someone can help me I'll be really thankful.
    Best regards,
    Georgi

    This is weird behavior that I don't experience with Awesome and Atom. Does this happen only with Atom, or with anything? One aspect of your rc.lua that might cause something like this is the sloppy focusing, this bit here:
    -- Enable sloppy focus
    c:connect_signal("mouse::enter", function(c)
    if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
    and awful.client.focus.filter(c) then
    client.focus = c
    end
    end)
    Try disabling that, by commenting it out entirely, and see if the problem persists.
    If it only happens with Atom, then maybe Atom conflicts for some reason with this sloppy focusing.

  • Vicious MPD widget not displaying the artist and song title

    EDIT: This thread can be closed now. It turns out Clementine doesn't support mpd and I'm now running ncmpcpp and the widget shows the artist and song title.
    I have trouble getting the mpd widget running in awesome wm, it will only display "N/A - N/A". I've read the wiki and done a lot of googling but I can't figure out what I'm missing.
    Here's my rc.lua
    -- Standard awesome library
    local gears = require("gears")
    local awful = require("awful")
    awful.rules = require("awful.rules")
    require("awful.autofocus")
    -- Widget and layout library
    local wibox = require("wibox")
    local vicious = require("vicious")
    -- Theme handling library
    local beautiful = require("beautiful")
    -- Notification library
    local naughty = require("naughty")
    local menubar = require("menubar")
    -- {{{ Error handling
    -- Check if awesome encountered an error during startup and fell back to
    -- another config (This code will only ever execute for the fallback config)
    if awesome.startup_errors then
    naughty.notify({ preset = naughty.config.presets.critical,
    title = "Oops, there were errors during startup!",
    text = awesome.startup_errors })
    end
    -- Handle runtime errors after startup
    do
    local in_error = false
    awesome.connect_signal("debug::error", function (err)
    -- Make sure we don't go into an endless error loop
    if in_error then return end
    in_error = true
    naughty.notify({ preset = naughty.config.presets.critical,
    title = "Oops, an error happened!",
    text = err })
    in_error = false
    end)
    end
    -- {{{ Variable definitions
    -- Themes define colours, icons, and wallpapers
    beautiful.init("/usr/share/awesome/themes/zenburn/theme.lua")
    -- This is used later as the default terminal and editor to run.
    terminal = "tilda"
    editor = "gedit"
    -- os.getenv("EDITOR") or
    editor_cmd = terminal .. " -e " .. editor
    -- Default modkey.
    -- Usually, Mod4 is the key with a logo between Control and Alt.
    -- If you do not like this or do not have such a key,
    -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
    -- However, you can use another modifier like Mod1, but it may interact with others.
    modkey = "Mod4"
    -- Table of layouts to cover with awful.layout.inc, order matters.
    local layouts =
    awful.layout.suit.floating,
    awful.layout.suit.tile,
    awful.layout.suit.tile.left,
    awful.layout.suit.tile.bottom,
    awful.layout.suit.tile.top,
    awful.layout.suit.fair,
    awful.layout.suit.fair.horizontal,
    awful.layout.suit.spiral,
    awful.layout.suit.spiral.dwindle,
    awful.layout.suit.max,
    awful.layout.suit.max.fullscreen,
    awful.layout.suit.magnifier
    -- {{{ Wallpaper
    if beautiful.wallpaper then
    for s = 1, screen.count() do
    gears.wallpaper.maximized(beautiful.wallpaper, s, true)
    end
    end
    -- {{{ Tags
    -- Define a tag table which will hold all screen tags.
    tags = {}
    for s = 1, screen.count() do
    -- Each screen has its own tag table.
    tags[s] = awful.tag({"term", "www", "mp3", "skype", "office", "dev", "misc" }, s)
    end
    -- {{{ Menu
    -- Create a laucher widget and a main menu
    myawesomemenu = {
    { "manual", terminal .. " -e man awesome" },
    { "edit config", editor_cmd .. " " .. awesome.conffile },
    { "reboot", "gksudo reboot" },
    { "restart", awesome.restart },
    { "quit", awesome.quit }
    mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
    { "open terminal", terminal }
    mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
    menu = mymainmenu })
    -- Menubar configuration
    menubar.utils.terminal = terminal -- Set the terminal for applications that require it
    -- Initialize widget
    mpdwidget = wibox.widget.textbox()
    -- Register widget
    vicious.register(mpdwidget, vicious.widgets.mpd,
    function (mpdwidget, args)
    if args["{state}"] == "Stop" then
    return " - "
    else
    return args["{Artist}"]..' - '.. args["{Title}"]
    end
    end, 10)
    -- {{{ Wibox
    -- Create a textclock widget
    mytextclock = awful.widget.textclock()
    -- Create a wibox for each screen and add it
    mywibox = {}
    mypromptbox = {}
    mylayoutbox = {}
    mytaglist = {}
    mytaglist.buttons = awful.util.table.join(
    awful.button({ }, 1, awful.tag.viewonly),
    awful.button({ modkey }, 1, awful.client.movetotag),
    awful.button({ }, 3, awful.tag.viewtoggle),
    awful.button({ modkey }, 3, awful.client.toggletag),
    awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
    awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
    mytasklist = {}
    mytasklist.buttons = awful.util.table.join(
    awful.button({ }, 1, function (c)
    if c == client.focus then
    c.minimized = true
    else
    -- Without this, the following
    -- :isvisible() makes no sense
    c.minimized = false
    if not c:isvisible() then
    awful.tag.viewonly(c:tags()[1])
    end
    -- This will also un-minimize
    -- the client, if needed
    client.focus = c
    c:raise()
    end
    end),
    awful.button({ }, 3, function ()
    if instance then
    instance:hide()
    instance = nil
    else
    instance = awful.menu.clients({ width=250 })
    end
    end),
    awful.button({ }, 4, function ()
    awful.client.focus.byidx(1)
    if client.focus then client.focus:raise() end
    end),
    awful.button({ }, 5, function ()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end))
    for s = 1, screen.count() do
    -- Create a promptbox for each screen
    mypromptbox[s] = awful.widget.prompt()
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    mylayoutbox[s] = awful.widget.layoutbox(s)
    mylayoutbox[s]:buttons(awful.util.table.join(
    awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
    awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
    awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
    awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
    -- Create a taglist widget
    mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
    -- Create a tasklist widget
    mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
    -- Create the wibox
    mywibox[s] = awful.wibox({ position = "top", screen = s })
    -- Widgets that are aligned to the left
    local left_layout = wibox.layout.fixed.horizontal()
    left_layout:add(mylauncher)
    left_layout:add(mytaglist[s])
    left_layout:add(mypromptbox[s])
    -- Widgets that are aligned to the right
    local right_layout = wibox.layout.fixed.horizontal()
    right_layout:add(mpdwidget)
    if s == 1 then right_layout:add(wibox.widget.systray()) end
    right_layout:add(mytextclock)
    right_layout:add(mylayoutbox[s])
    -- Now bring it all together (with the tasklist in the middle)
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    layout:set_middle(mytasklist[s])
    layout:set_right(right_layout)
    mywibox[s]:set_widget(layout)
    end
    -- {{{ Mouse bindings
    root.buttons(awful.util.table.join(
    awful.button({ }, 3, function () mymainmenu:toggle() end),
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev)
    -- {{{ Key bindings
    globalkeys = awful.util.table.join(
    awful.key({ modkey, }, "Left", awful.tag.viewprev ),
    awful.key({ modkey, }, "Right", awful.tag.viewnext ),
    awful.key({ modkey, }, "Escape", awful.tag.history.restore),
    awful.key({ modkey, }, "j",
    function ()
    awful.client.focus.byidx( 1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey, }, "k",
    function ()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey, }, "w", function () mymainmenu:show() end),
    -- Layout manipulation
    awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
    awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
    awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
    awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
    awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
    awful.key({ modkey, }, "Tab",
    function ()
    awful.client.focus.history.previous()
    if client.focus then
    client.focus:raise()
    end
    end),
    -- Standard program
    awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
    awful.key({ modkey, "Control" }, "r", awesome.restart),
    awful.key({ modkey, "Shift" }, "q", awesome.quit),
    awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
    awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
    awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
    awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
    awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
    awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
    awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
    awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
    awful.key({ modkey, "Control" }, "n", awful.client.restore),
    -- Prompt
    awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
    awful.key({ modkey }, "x",
    function ()
    awful.prompt.run({ prompt = "Run Lua code: " },
    mypromptbox[mouse.screen].widget,
    awful.util.eval, nil,
    awful.util.getdir("cache") .. "/history_eval")
    end),
    -- Menubar
    awful.key({ modkey }, "p", function() menubar.show() end)
    clientkeys = awful.util.table.join(
    awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
    awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
    awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
    awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
    awful.key({ modkey, }, "o", awful.client.movetoscreen ),
    awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
    awful.key({ modkey, }, "n",
    function (c)
    -- The client currently has the input focus, so it cannot be
    -- minimized, since minimized clients can't have the focus.
    c.minimized = true
    end),
    awful.key({ modkey, }, "m",
    function (c)
    c.maximized_horizontal = not c.maximized_horizontal
    c.maximized_vertical = not c.maximized_vertical
    end)
    -- Bind all key numbers to tags.
    -- Be careful: we use keycodes to make it works on any keyboard layout.
    -- This should map on the top row of your keyboard, usually 1 to 9.
    for i = 1, 9 do
    globalkeys = awful.util.table.join(globalkeys,
    awful.key({ modkey }, "#" .. i + 9,
    function ()
    local screen = mouse.screen
    local tag = awful.tag.gettags(screen)[i]
    if tag then
    awful.tag.viewonly(tag)
    end
    end),
    awful.key({ modkey, "Control" }, "#" .. i + 9,
    function ()
    local screen = mouse.screen
    local tag = awful.tag.gettags(screen)[i]
    if tag then
    awful.tag.viewtoggle(tag)
    end
    end),
    awful.key({ modkey, "Shift" }, "#" .. i + 9,
    function ()
    if client.focus then
    local tag = awful.tag.gettags(client.focus.screen)[i]
    if tag then
    awful.client.movetotag(tag)
    end
    end
    end),
    awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
    function ()
    if client.focus then
    local tag = awful.tag.gettags(client.focus.screen)[i]
    if tag then
    awful.client.toggletag(tag)
    end
    end
    end))
    end
    clientbuttons = awful.util.table.join(
    awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
    awful.button({ modkey }, 1, awful.mouse.client.move),
    awful.button({ modkey }, 3, awful.mouse.client.resize))
    -- Set keys
    root.keys(globalkeys)
    -- {{{ Rules
    awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
    properties = { border_width = beautiful.border_width,
    border_color = beautiful.border_normal,
    focus = awful.client.focus.filter,
    keys = clientkeys,
    buttons = clientbuttons } },
    { rule = { class = "MPlayer" },
    properties = { floating = true } },
    { rule = { class = "pinentry" },
    properties = { floating = true } },
    { rule = { class = "gimp" },
    properties = { floating = true } },
    -- Set Firefox to always map on tags number 2 of screen 1.
    { rule = { class = "Firefox" },
    properties = { tag = tags[2] } },
    -- {{{ Signals
    -- Signal function to execute when a new client appears.
    client.connect_signal("manage", function (c, startup)
    -- Enable sloppy focus
    c:connect_signal("mouse::enter", function(c)
    if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
    and awful.client.focus.filter(c) then
    client.focus = c
    end
    end)
    if not startup then
    -- Set the windows at the slave,
    -- i.e. put it at the end of others instead of setting it master.
    -- awful.client.setslave(c)
    -- Put windows in a smart way, only if they does not set an initial position.
    if not c.size_hints.user_position and not c.size_hints.program_position then
    awful.placement.no_overlap(c)
    awful.placement.no_offscreen(c)
    end
    end
    local titlebars_enabled = false
    if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
    -- buttons for the titlebar
    local buttons = awful.util.table.join(
    awful.button({ }, 1, function()
    client.focus = c
    c:raise()
    awful.mouse.client.move(c)
    end),
    awful.button({ }, 3, function()
    client.focus = c
    c:raise()
    awful.mouse.client.resize(c)
    end)
    -- Widgets that are aligned to the left
    local left_layout = wibox.layout.fixed.horizontal()
    left_layout:add(awful.titlebar.widget.iconwidget(c))
    left_layout:buttons(buttons)
    -- Widgets that are aligned to the right
    local right_layout = wibox.layout.fixed.horizontal()
    right_layout:add(awful.titlebar.widget.floatingbutton(c))
    right_layout:add(awful.titlebar.widget.maximizedbutton(c))
    right_layout:add(awful.titlebar.widget.stickybutton(c))
    right_layout:add(awful.titlebar.widget.ontopbutton(c))
    right_layout:add(awful.titlebar.widget.closebutton(c))
    -- The title goes in the middle
    local middle_layout = wibox.layout.flex.horizontal()
    local title = awful.titlebar.widget.titlewidget(c)
    title:set_align("center")
    middle_layout:add(title)
    middle_layout:buttons(buttons)
    -- Now bring it all together
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    layout:set_right(right_layout)
    layout:set_middle(middle_layout)
    awful.titlebar(c):set_widget(layout)
    end
    end)
    client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
    client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
    function run_once(prg,arg_string,pname,screen)
    if not prg then
    do return nil end
    end
    if not pname then
    pname = prg
    end
    if not arg_string then
    awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. pname .. "' || (" .. prg .. ")",screen)
    else
    awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. pname .. " ".. arg_string .."' || (" .. prg .. " " .. arg_string .. ")",screen)
    end
    end
    awful.util.spawn_with_shell("setxkbmap -layout se")
    run_once("tilda",nil,nil,"term")
    run_once("firefox &",nil,nil,"www")
    run_once("clementine ",nil,nil,"mp3")
    run_once("skype ",nil,nil,"skype")
    run_once("dropboxd &",nil,nil,nil)
    run_once("keepassx ",nil,nil,"www")
    run_once("volumeicon &",nil,nil,nil)
    awesome.font = "DejaVuSansCondensed 12"
    Here's my mpd.lua:
    -- Licensed under the GNU General Public License v2
    -- * (c) 2010, Adrian C. <[email protected]>
    -- {{{ Grab environment
    local tonumber = tonumber
    local io = { popen = io.popen }
    local setmetatable = setmetatable
    local string = { gmatch = string.gmatch }
    local helpers = require("vicious.helpers")
    -- Mpd: provides Music Player Daemon information
    -- vicious.widgets.mpd
    local mpd = {}
    -- {{{ MPD widget type
    local function worker(format, warg)
    local mpd_state = {
    ["{volume}"] = 0,
    ["{state}"] = "N/A",
    ["{Artist}"] = "N/A",
    ["{Title}"] = "N/A",
    ["{Album}"] = "N/A",
    ["{Genre}"] = "N/A",
    --["{Name}"] = "N/A",
    --["{file}"] = "N/A",
    -- Fallback to MPD defaults
    local pass = warg and (warg.password or warg[1]) or "\"\""
    local host = warg and (warg.host or warg[2]) or "127.0.0.1"
    local port = warg and (warg.port or warg[3]) or "6600"
    -- Construct MPD client options
    local mpdh = "telnet://"..host..":"..port
    local echo = "echo 'password "..pass.."\nstatus\ncurrentsong\nclose'"
    -- Get data from MPD server
    local f = io.popen(echo.." | curl --connect-timeout 1 -fsm 3 "..mpdh)
    for line in f:lines() do
    for k, v in string.gmatch(line, "([%w]+):[%s](.*)$") do
    if k == "volume" then mpd_state["{"..k.."}"] = v and tonumber(v)
    elseif k == "state" then mpd_state["{"..k.."}"] = helpers.capitalize(v)
    elseif k == "Artist" then mpd_state["{"..k.."}"] = helpers.escape(v)
    elseif k == "Title" then mpd_state["{"..k.."}"] = helpers.escape(v)
    elseif k == "Album" then mpd_state["{"..k.."}"] = helpers.escape(v)
    elseif k == "Genre" then mpd_state["{"..k.."}"] = helpers.escape(v)
    --elseif k == "Name" then mpd_state["{"..k.."}"] = helpers.escape(v)
    --elseif k == "file" then mpd_state["{"..k.."}"] = helpers.escape(v)
    end
    end
    end
    f:close()
    return mpd_state
    end
    return setmetatable(mpd, { __call = function(_, ...) return worker(...) end })
    I'm using Clementine to play the music if that makes a difference.
    Last edited by DisposableHero (2013-11-25 01:12:01)

    Hi,
    If the songs were purchased from itunes, I suggest that you delete the tracks from your itunes library and move to trash (providing you live in a country that permits redownloading). See http://support.apple.com/kb/PH12283.
    Jim

  • Problem with display an image on JFrame in Java 6

    I'm trying to display an image on JFrame in this way:
    1.) I'm creating a variable in the class:
        private Image imgSpeaker = null;2.) I'm overiting the paint method:
    public void paint(Graphics g) {
            super.paint(g);   
            g.drawImage(imgSpeaker, 330, 230, null);  
        }3.) In the constructor I'm using this code:
       imgSpeaker = Toolkit.getDefaultToolkit().getImage("D:\\speaker.gif");
            MediaTracker trop = new MediaTracker(this);
            trop.addImage(imgSpeaker,0);
            try {
                trop.waitForID(0);    // waiting untill downloading progress will be complite
            } catch (Exception e) {
                System.err.println(e);
            }        The Image will be displayed on form, but if I catch the window and move it (for example: down as possible)
    the image is not refreshed (repainted). What I'm doing wrong? I've been used this solution in Java 5 and everything
    works perfectly. Any of described methods aren't depricated... Anyone can help me?

    Thanks for your code, I've been tryed to apply your solution (with create a Buffered Image), but it still not working correctly. Firstly, the image isn't loading, and secondly the basic problem is not give in. Why have you been using "bg2d.draw(img, x, y, w, h, frame);" not in the paint method?
    I'm use "Free Design" layout. Below I put on completly code from Netbeans.
    import java.awt.Graphics;
    import java.awt.Image;
    import java.awt.MediaTracker;
    import java.awt.image.BufferedImage;
    public class ImageTest extends javax.swing.JFrame {
        private Image imgSpeaker = null;
        private BufferedImage bi = null;
        private MediaTracker trop = null;
        public ImageTest() { 
                initComponents();
                trop = new java.awt.MediaTracker(this);
                imgSpeaker = java.awt.Toolkit.getDefaultToolkit().getImage("D:\\speaker.gif");
                try {
                    trop.addImage(imgSpeaker, 0);
                    trop.waitForID(0);
                } catch (java.lang.Exception e) {
                    java.lang.System.err.println(e);
                bi = new java.awt.image.BufferedImage(100, 100, java.awt.image.BufferedImage.TYPE_INT_RGB);
                java.awt.Graphics2D bg2d = (java.awt.Graphics2D) bi.createGraphics();
                trop.addImage(bi, 1);
    //            java.io.File f = new java.io.File("D:\\speaker.gif");
    //            try {
    //                bi = javax.imageio.ImageIO.read(f);
    //            } catch (IOException e) {
    //               java.lang.System.err.println(e);
        public void paint(Graphics g) {
    //      super.paint(g);
           try {                                                   
                trop.waitForAll();                                 
            } catch (Exception e) {
                System.err.println(e);
            g.drawImage(bi, 50, 100, imgSpeaker.getHeight(this), imgSpeaker.getHeight(this), this);
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents() {
            jButton1 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jButton1.setText("jButton1");
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(283, Short.MAX_VALUE)
                    .addComponent(jButton1)
                    .addGap(44, 44, 44))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(252, Short.MAX_VALUE)
                    .addComponent(jButton1)
                    .addGap(25, 25, 25))
            pack();
        }// </editor-fold>
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new ImageTest().setVisible(true);
        private javax.swing.JButton jButton1;
    }

  • Second monitor "hide" the programs behind the screen background.

    Hi!
    Updated my system a couple of days ago. When I rebooted, my second screen comes up as normal, except I can't get anything to show on that screen.
    The primary screen works as normal. The second screen shows the background and conky, but when I try to open anything on the screen, it opens, kind of behind the background. I can use the program, and drag it to the first screen. Then I see it. It's almost like the screen background covers it.
    Have a nvidia GPU and using Awesome as VM.
    Anyone have an idea what the problem might be?
    My rc.lua, 10-monitor.conf and pacman.log
    -- Standard awesome library
    local gears = require("gears")
    local awful = require("awful")
    awful.rules = require("awful.rules")
    require("awful.autofocus")
    -- Widget and layout library
    local wibox = require("wibox")
    -- Theme handling library
    local beautiful = require("beautiful")
    -- Notification library
    local naughty = require("naughty")
    local menubar = require("menubar")
    -- Menu
    require("myplacesmenu")
    -- {{{ Error handling
    -- Check if awesome encountered an error during startup and fell back to
    -- another config (This code will only ever execute for the fallback config)
    if awesome.startup_errors then
    naughty.notify({ preset = naughty.config.presets.critical,
    title = "Oops, there were errors during startup!",
    text = awesome.startup_errors })
    end
    -- Handle runtime errors after startup
    do
    local in_error = false
    awesome.connect_signal("debug::error", function (err)
    -- Make sure we don't go into an endless error loop
    if in_error then return end
    in_error = true
    naughty.notify({ preset = naughty.config.presets.critical,
    title = "Oops, an error happened!",
    text = err })
    in_error = false
    end)
    end
    -- {{{ Variable definitions
    -- Themes define colours, icons, and wallpapers
    beautiful.init("/usr/share/awesome/themes/default/theme.lua")
    -- This is used later as the default terminal and editor to run.
    terminal = "urxvt"
    editor = os.getenv("EDITOR") or "nano"
    editor_cmd = terminal .. " -e " .. editor
    -- Default modkey.
    -- Usually, Mod4 is the key with a logo between Control and Alt.
    -- If you do not like this or do not have such a key,
    -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
    -- However, you can use another modifier like Mod1, but it may interact with others.
    modkey = "Mod4"
    -- Table of layouts to cover with awful.layout.inc, order matters.
    local layouts =
    awful.layout.suit.floating,
    awful.layout.suit.tile,
    awful.layout.suit.tile.left,
    awful.layout.suit.tile.bottom,
    awful.layout.suit.tile.top,
    awful.layout.suit.fair,
    awful.layout.suit.fair.horizontal,
    awful.layout.suit.spiral,
    awful.layout.suit.spiral.dwindle,
    awful.layout.suit.max,
    awful.layout.suit.max.fullscreen,
    awful.layout.suit.magnifier
    -- {{{ Wallpaper
    if beautiful.wallpaper then
    for s = 1, screen.count() do
    gears.wallpaper.maximized(beautiful.wallpaper, s, true)
    end
    end
    -- {{{ Tags
    -- Define a tag table which hold all screen tags.
    tags = {}
    for s = 1, screen.count() do
    -- Each screen has its own tag table.
    tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1])
    end
    -- {{{ Menu
    -- Create a laucher widget and a main menu
    myawesomemenu = {
    { "files", myplacesmenu.myplacesmenu()},
    { "manual", terminal .. " -e man awesome" },
    { "edit config", editor_cmd .. " " .. awesome.conffile },
    { "restart", awesome.restart },
    { "quit", awesome.quit }
    mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
    { "open terminal", terminal }
    mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
    menu = mymainmenu })
    -- Menubar configuration
    menubar.utils.terminal = terminal -- Set the terminal for applications that require it
    -- {{{ Wibox
    -- Create a "Change keyboard layout switcher"
    kbdcfg = {}
    kbdcfg.cmd = "setxkbmap"
    kbdcfg.lang = { "us", "no" }
    kbdcfg.lang_caps = { " US ", " NO " }
    kbdcfg.current = 1 -- us is our default layout
    kbdcfg.widget = wibox.widget.textbox()
    kbdcfg.widget:set_text(" " .. kbdcfg.lang_caps[kbdcfg.current] .. " ")
    kbdcfg.switch = function ()
    kbdcfg.current = kbdcfg.current % #(kbdcfg.lang) + 1
    kbdcfg.widget:set_text(" " .. kbdcfg.lang_caps[kbdcfg.current] .. " ")
    local t = " " .. kbdcfg.lang[kbdcfg.current] .. " "
    os.execute( kbdcfg.cmd .. t )
    end
    -- Create a textclock widget
    mytextclock = awful.widget.textclock()
    -- Create a wibox for each screen and add it
    mywibox = {}
    mypromptbox = {}
    mylayoutbox = {}
    mytaglist = {}
    mytaglist.buttons = awful.util.table.join(
    awful.button({ }, 1, awful.tag.viewonly),
    awful.button({ modkey }, 1, awful.client.movetotag),
    awful.button({ }, 3, awful.tag.viewtoggle),
    awful.button({ modkey }, 3, awful.client.toggletag),
    awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
    awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
    mytasklist = {}
    mytasklist.buttons = awful.util.table.join(
    awful.button({ }, 1, function (c)
    if c == client.focus then
    c.minimized = true
    else
    -- Without this, the following
    -- :isvisible() makes no sense
    c.minimized = false
    if not c:isvisible() then
    awful.tag.viewonly(c:tags()[1])
    end
    -- This will also un-minimize
    -- the client, if needed
    client.focus = c
    c:raise()
    end
    end),
    awful.button({ }, 3, function ()
    if instance then
    instance:hide()
    instance = nil
    else
    instance = awful.menu.clients({ width=250 })
    end
    end),
    awful.button({ }, 4, function ()
    awful.client.focus.byidx(1)
    if client.focus then client.focus:raise() end
    end),
    awful.button({ }, 5, function ()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end))
    for s = 1, screen.count() do
    -- Create a promptbox for each screen
    mypromptbox[s] = awful.widget.prompt()
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    mylayoutbox[s] = awful.widget.layoutbox(s)
    mylayoutbox[s]:buttons(awful.util.table.join(
    awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
    awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
    awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
    awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
    -- Create a taglist widget
    mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
    -- Create a tasklist widget
    mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
    -- Create the wibox
    mywibox[s] = awful.wibox({ position = "top", screen = s })
    -- Widgets that are aligned to the left
    local left_layout = wibox.layout.fixed.horizontal()
    left_layout:add(mylauncher)
    left_layout:add(mytaglist[s])
    left_layout:add(mypromptbox[s])
    -- Widgets that are aligned to the right
    local right_layout = wibox.layout.fixed.horizontal()
    if s == 1 then right_layout:add(wibox.widget.systray()) end
    right_layout:add(kbdcfg.widget)
    right_layout:add(mytextclock)
    right_layout:add(mylayoutbox[s])
    -- Now bring it all together (with the tasklist in the middle)
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    layout:set_middle(mytasklist[s])
    layout:set_right(right_layout)
    mywibox[s]:set_widget(layout)
    end
    -- {{{ Mouse bindings
    root.buttons(awful.util.table.join(
    awful.button({ }, 3, function () mymainmenu:toggle() end),
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev)
    -- Keyboard switcher mouse bindings
    kbdcfg.widget:buttons(awful.util.table.join(
    awful.button({ }, 1, function () kbdcfg.switch() end)
    -- {{{ Key bindings
    globalkeys = awful.util.table.join(
    awful.key({ modkey, }, "Left", awful.tag.viewprev ),
    awful.key({ modkey, }, "Right", awful.tag.viewnext ),
    awful.key({ modkey, }, "Escape", awful.tag.history.restore),
    awful.key({ modkey, }, "j",
    function ()
    awful.client.focus.byidx( 1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey, }, "k",
    function ()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey, }, "w", function () mymainmenu:show() end),
    -- Layout manipulation
    awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
    awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
    awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
    awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
    awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
    awful.key({ modkey, }, "Tab",
    function ()
    awful.client.focus.history.previous()
    if client.focus then
    client.focus:raise()
    end
    end),
    -- Standard program
    awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
    awful.key({ modkey, "Control" }, "r", awesome.restart),
    awful.key({ modkey, "Shift" }, "q", awesome.quit),
    awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
    awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
    awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
    awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
    awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
    awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
    awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
    awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
    awful.key({ modkey, "Control" }, "n", awful.client.restore),
    -- Prompt
    awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
    -- Keyboard switcher
    awful.key({ modkey, "Shift" }, "a", function () kbdcfg.switch() end),
    -- Start stuff
    awful.key({ modkey, "Shift" }, "s", function () awful.util.spawn("thunar") end),
    awful.key({ }, "#180", function () awful.util.spawn("chromium") end),
    awful.key({ }, "#163", function () awful.util.spawn("thunderbird") end),
    awful.key({ modkey }, "x",
    function ()
    awful.prompt.run({ prompt = "Run Lua code: " },
    mypromptbox[mouse.screen].widget,
    awful.util.eval, nil,
    awful.util.getdir("cache") .. "/history_eval")
    end),
    -- Menubar
    awful.key({ modkey }, "p", function() menubar.show() end)
    clientkeys = awful.util.table.join(
    awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
    awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
    awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
    awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
    awful.key({ modkey, }, "o", awful.client.movetoscreen ),
    awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
    awful.key({ modkey, }, "n",
    function (c)
    -- The client currently has the input focus, so it cannot be
    -- minimized, since minimized clients can't have the focus.
    c.minimized = true
    end),
    awful.key({ modkey, }, "m",
    function (c)
    c.maximized_horizontal = not c.maximized_horizontal
    c.maximized_vertical = not c.maximized_vertical
    end)
    -- Compute the maximum number of digit we need, limited to 9
    keynumber = 0
    for s = 1, screen.count() do
    keynumber = math.min(9, math.max(#tags[s], keynumber))
    end
    -- Bind all key numbers to tags.
    -- Be careful: we use keycodes to make it works on any keyboard layout.
    -- This should map on the top row of your keyboard, usually 1 to 9.
    for i = 1, keynumber do
    globalkeys = awful.util.table.join(globalkeys,
    awful.key({ modkey }, "#" .. i + 9,
    function ()
    local screen = mouse.screen
    if tags[screen][i] then
    awful.tag.viewonly(tags[screen][i])
    end
    end),
    awful.key({ modkey, "Control" }, "#" .. i + 9,
    function ()
    local screen = mouse.screen
    if tags[screen][i] then
    awful.tag.viewtoggle(tags[screen][i])
    end
    end),
    awful.key({ modkey, "Shift" }, "#" .. i + 9,
    function ()
    if client.focus and tags[client.focus.screen][i] then
    awful.client.movetotag(tags[client.focus.screen][i])
    end
    end),
    awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
    function ()
    if client.focus and tags[client.focus.screen][i] then
    awful.client.toggletag(tags[client.focus.screen][i])
    end
    end))
    end
    clientbuttons = awful.util.table.join(
    awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
    awful.button({ modkey }, 1, awful.mouse.client.move),
    awful.button({ modkey }, 3, awful.mouse.client.resize))
    -- Set keys
    root.keys(globalkeys)
    -- {{{ Rules
    awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
    properties = { border_width = beautiful.border_width,
    border_color = beautiful.border_normal,
    focus = awful.client.focus.filter,
    keys = clientkeys,
    buttons = clientbuttons } },
    { rule = { class = "MPlayer" },
    properties = { floating = true } },
    { rule = { class = "pinentry" },
    properties = { floating = true } },
    { rule = { class = "gimp" },
    properties = { floating = true } },
    -- Set Firefox to always map on tags number 2 of screen 1.
    -- { rule = { class = "Firefox" },
    -- properties = { tag = tags[1][2] } },
    -- {{{ Signals
    -- Signal function to execute when a new client appears.
    client.connect_signal("manage", function (c, startup)
    -- Enable sloppy focus
    c:connect_signal("mouse::enter", function(c)
    if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
    and awful.client.focus.filter(c) then
    client.focus = c
    end
    end)
    if not startup then
    -- Set the windows at the slave,
    -- i.e. put it at the end of others instead of setting it master.
    -- awful.client.setslave(c)
    -- Put windows in a smart way, only if they does not set an initial position.
    if not c.size_hints.user_position and not c.size_hints.program_position then
    awful.placement.no_overlap(c)
    awful.placement.no_offscreen(c)
    end
    end
    local titlebars_enabled = false
    if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
    -- Widgets that are aligned to the left
    local left_layout = wibox.layout.fixed.horizontal()
    left_layout:add(awful.titlebar.widget.iconwidget(c))
    -- Widgets that are aligned to the right
    local right_layout = wibox.layout.fixed.horizontal()
    right_layout:add(awful.titlebar.widget.floatingbutton(c))
    right_layout:add(awful.titlebar.widget.maximizedbutton(c))
    right_layout:add(awful.titlebar.widget.stickybutton(c))
    right_layout:add(awful.titlebar.widget.ontopbutton(c))
    right_layout:add(awful.titlebar.widget.closebutton(c))
    -- The title goes in the middle
    local title = awful.titlebar.widget.titlewidget(c)
    title:buttons(awful.util.table.join(
    awful.button({ }, 1, function()
    client.focus = c
    c:raise()
    awful.mouse.client.move(c)
    end),
    awful.button({ }, 3, function()
    client.focus = c
    c:raise()
    awful.mouse.client.resize(c)
    end)
    -- Now bring it all together
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    layout:set_right(right_layout)
    layout:set_middle(title)
    awful.titlebar(c):set_widget(layout)
    end
    end)
    client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
    client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
    Section "ServerLayout"
    Identifier "DualSreen"
    Screen 0 "Screen0"
    Screen 1 "Screen1" RightOf "Screen0" #Screen1 at the right of Screen0
    Option "Xinerama" "1" #To move windows between screens
    EndSection
    Section "Monitor"
    Identifier "Monitor0"
    Option "Enable" "true"
    EndSection
    Section "Monitor"
    Identifier "Monitor1"
    Option "Enable" "true"
    EndSection
    Section "Device"
    Identifier "Device0"
    Driver "nvidia"
    Screen 0
    EndSection
    Section "Device"
    Identifier "Device1"
    Driver "nvidia"
    Screen 1
    EndSection
    Section "Screen"
    Identifier "Screen0"
    Device "Device0"
    Monitor "Monitor0"
    DefaultDepth 24
    Option "TwinView" "0"
    SubSection "Display"
    Depth 24
    Modes "1920x1080_75.00"
    EndSubSection
    EndSection
    Section "Screen"
    Identifier "Screen1"
    Device "Device1"
    Monitor "Monitor1"
    DefaultDepth 24
    Option "TwinView" "0"
    SubSection "Display"
    Depth 24
    Modes "1280x1024_60.00"
    EndSubSection
    EndSection
    [2014-02-03 17:44] [PACMAN] upgraded archlinux-keyring (20131027-1 -> 20140124-1)
    [2014-02-03 17:44] [PACMAN] upgraded blas (3.4.2-2 -> 3.5.0-1)
    [2014-02-03 17:44] [PACMAN] upgraded nss (3.15.3.1-1 -> 3.15.4-1)
    [2014-02-03 17:44] [PACMAN] upgraded xdg-utils (1.1.0.git20130520-1 -> 1.1.0.git20140109-1)
    [2014-02-03 17:44] [PACMAN] upgraded libgcrypt (1.5.3-1 -> 1.6.1-1)
    [2014-02-03 17:44] [PACMAN] upgraded glibc (2.18-11 -> 2.18-12)
    [2014-02-03 17:44] [PACMAN] upgraded libdbus (1.6.18-3 -> 1.8.0-1)
    [2014-02-03 17:44] [PACMAN] upgraded dbus (1.6.18-3 -> 1.8.0-1)
    [2014-02-03 17:44] [PACMAN] upgraded libcap (2.23-2 -> 2.24-1)
    [2014-02-03 17:44] [PACMAN] upgraded util-linux (2.24-2 -> 2.24.1-1)
    [2014-02-03 17:44] [PACMAN] upgraded systemd (208-3 -> 208-10)
    [2014-02-03 17:44] [PACMAN] upgraded pciutils (3.2.0-4 -> 3.2.1-1)
    [2014-02-03 17:44] [PACMAN] upgraded chromium (31.0.1650.63-1 -> 32.0.1700.102-1)
    [2014-02-03 17:44] [PACMAN] upgraded libdrm (2.4.50-1 -> 2.4.52-1)
    [2014-02-03 17:44] [PACMAN] upgraded wayland (1.3.0-1 -> 1.4.0-1)
    [2014-02-03 17:44] [PACMAN] upgraded llvm-libs (3.3-1 -> 3.4-1)
    [2014-02-03 17:44] [PACMAN] upgraded mesa (10.0.1-2 -> 10.0.2-1)
    [2014-02-03 17:44] [PACMAN] upgraded libpng (1.6.7-1 -> 1.6.8-1)
    [2014-02-03 17:44] [PACMAN] upgraded gdk-pixbuf2 (2.30.2-1 -> 2.30.3-1)
    [2014-02-03 17:44] [PACMAN] upgraded cogl (1.16.0-2 -> 1.16.2-1)
    [2014-02-03 17:44] [PACMAN] upgraded xkeyboard-config (2.10.1-1 -> 2.11-1)
    [2014-02-03 17:44] [PACMAN] upgraded libxkbcommon (0.3.2-1 -> 0.4.0-1)
    [2014-02-03 17:44] [PACMAN] upgraded libevdev (0.4-2 -> 0.6-1)
    [2014-02-03 17:44] [PACMAN] upgraded clutter (1.16.2-1 -> 1.16.4-1)
    [2014-02-03 17:44] [PACMAN] upgraded colord (1.0.4-1 -> 1.0.6-1)
    [2014-02-03 17:44] [PACMAN] upgraded cppunit (1.13.1-1 -> 1.13.2-1)
    [2014-02-03 17:44] [PACMAN] upgraded device-mapper (2.02.104-1 -> 2.02.105-1)
    [2014-02-03 17:44] [PACMAN] upgraded cryptsetup (1.6.3-1 -> 1.6.3-2)
    [2014-02-03 17:44] [PACMAN] upgraded e2fsprogs (1.42.8-2 -> 1.42.9-1)
    [2014-02-03 17:44] [PACMAN] upgraded libldap (2.4.38-1 -> 2.4.39-1)
    [2014-02-03 17:44] [PACMAN] upgraded krb5 (1.11.4-1 -> 1.12.1-1)
    [2014-02-03 17:44] [PACMAN] upgraded curl (7.34.0-2 -> 7.35.0-1)
    [2014-02-03 17:44] [PACMAN] upgraded dialog (1:1.2_20130928-1 -> 1:1.2_20140112-1)
    [2014-02-03 17:44] [PACMAN] upgraded pth (2.0.7-4 -> 2.0.7-5)
    [2014-02-03 17:44] [PACMAN] upgraded dirmngr (1.1.1-1 -> 1.1.1-2)
    [2014-02-03 17:44] [PACMAN] upgraded epdfview (0.1.8-4 -> 0.1.8-5)
    [2014-02-03 17:44] [PACMAN] upgraded exiv2 (0.23-2 -> 0.24-1)
    [2014-02-03 17:44] [PACMAN] upgraded gnutls (3.2.8-1 -> 3.2.10-1)
    [2014-02-03 17:44] [PACMAN] upgraded libvorbis (1.3.3-1 -> 1.3.4-1)
    [2014-02-03 17:44] [PACMAN] upgraded v4l-utils (1.0.0-2 -> 1.0.1-1)
    [2014-02-03 17:44] [PACMAN] upgraded ffmpeg (1:2.1.1-3 -> 1:2.1.3-1)
    [2014-02-03 17:44] [PACMAN] upgraded fribidi (0.19.5-1 -> 0.19.6-1)
    [2014-02-03 17:44] [PACMAN] installed libatomic_ops (7.2.e-1)
    [2014-02-03 17:44] [PACMAN] upgraded gc (7.2.d-2 -> 7.4.0-1)
    [2014-02-03 17:44] [PACMAN] upgraded gdbm (1.10-3 -> 1.11-1)
    [2014-02-03 17:44] [PACMAN] upgraded geeqie (1.1-2 -> 1.1-3)
    [2014-02-03 17:44] [PACMAN] upgraded geoip-database (20131106-1 -> 20140108-1)
    [2014-02-03 17:44] [PACMAN] upgraded gettext (0.18.3.1-2 -> 0.18.3.2-1)
    [2014-02-03 17:44] [PACMAN] upgraded perl (5.18.1-1 -> 5.18.2-2)
    [2014-02-03 17:44] [PACMAN] upgraded pcre (8.34-1 -> 8.34-2)
    [2014-02-03 17:44] [PACMAN] upgraded git (1.8.5.2-1 -> 1.8.5.3-1)
    [2014-02-03 17:44] [PACMAN] upgraded glproto (1.4.16-1 -> 1.4.17-1)
    [2014-02-03 17:44] [PACMAN] upgraded gnupg (2.0.22-1 -> 2.0.22-2)
    [2014-02-03 17:44] [PACMAN] upgraded gparted (0.17.0-1 -> 0.17.0-2)
    [2014-02-03 17:44] [PACMAN] upgraded grub (1:2.00.1282.g5ae5c54-1 -> 1:2.02.beta2-1)
    [2014-02-03 17:44] [PACMAN] upgraded gstreamer (1.2.1-1 -> 1.2.2-1)
    [2014-02-03 17:44] [PACMAN] upgraded gst-plugins-base-libs (1.2.1-1 -> 1.2.2-1)
    [2014-02-03 17:44] [PACMAN] upgraded librsvg (1:2.40.1-1 -> 1:2.40.1-3)
    [2014-02-03 17:44] [PACMAN] upgraded libwebp (0.3.1-3 -> 0.4.0-1)
    [2014-02-03 17:44] [PACMAN] upgraded libsecret (0.16-1 -> 0.16-2)
    [2014-02-03 17:44] [PACMAN] upgraded libxslt (1.1.28-2 -> 1.1.28-3)
    [2014-02-03 17:44] [PACMAN] upgraded libxfont (1.4.6-1 -> 1.4.7-1)
    [2014-02-03 17:44] [PACMAN] upgraded xorg-server-common (1.14.5-2 -> 1.15.0-5)
    [2014-02-03 17:44] [PACMAN] upgraded xf86-input-evdev (2.8.2-1 -> 2.8.2-2)
    [2014-02-03 17:44] [PACMAN] installed libxshmfence (1.1-1)
    [2014-02-03 17:44] [PACMAN] upgraded xorg-server (1.14.5-2 -> 1.15.0-5)
    [2014-02-03 17:44] [PACMAN] upgraded nvidia-utils (331.20-1 -> 331.38-1)
    [2014-02-03 17:44] [PACMAN] upgraded nvidia-libgl (331.20-1 -> 331.38-1)
    [2014-02-03 17:44] [PACMAN] upgraded libcups (1.7.0-2 -> 1.7.1-3)
    [2014-02-03 17:44] [PACMAN] upgraded gtk3 (3.10.6-1 -> 3.10.7-1)
    [2014-02-03 17:44] [PACMAN] upgraded webkitgtk (2.2.3-1 -> 2.2.4-2)
    [2014-02-03 17:44] [PACMAN] upgraded gthumb (3.2.6-1 -> 3.2.6-3)
    [2014-02-03 17:44] [PACMAN] upgraded libcdio (0.90-2 -> 0.92-1)
    [2014-02-03 17:44] [PACMAN] upgraded libcdio-paranoia (10.2+0.90+1-1 -> 10.2+0.90+1-2)
    [2014-02-03 17:44] [PACMAN] upgraded gvfs (1.18.3-1 -> 1.18.3-3)
    [2014-02-03 17:44] [PACMAN] upgraded vim-runtime (7.4.86-1 -> 7.4.135-2)
    [2014-02-03 17:44] [PACMAN] upgraded ruby (2.0.0_p353-1 -> 2.1.0-2)
    [2014-02-03 17:44] [PACMAN] upgraded gvim (7.4.86-1 -> 7.4.135-2)
    [2014-02-03 17:44] [PACMAN] upgraded hdf5 (1.8.11-1 -> 1.8.12-1)
    [2014-02-03 17:44] [PACMAN] upgraded wxgtk (2.8.12.1-5 -> 3.0.0-2)
    [2014-02-03 17:44] [PACMAN] upgraded lapack (3.4.2-2 -> 3.5.0-1)
    [2014-02-03 17:44] [PACMAN] upgraded perl-image-exiftool (9.27-1 -> 9.46-1)
    [2014-02-03 17:45] [PACMAN] upgraded hugin (2013.0.0-3 -> 2013.0.0-6)
    [2014-02-03 17:45] [PACMAN] upgraded imagemagick (6.8.8.1-1 -> 6.8.8.4-2)
    [2014-02-03 17:45] [PACMAN] upgraded imlib2 (1.4.5-6 -> 1.4.6-1)
    [2014-02-03 17:45] [PACMAN] upgraded inetutils (1.9.1.341-2 -> 1.9.2-1)
    [2014-02-03 17:45] [PACMAN] upgraded isl (0.12.1-2 -> 0.12.2-1)
    [2014-02-03 17:45] [PACMAN] upgraded jack (0.121.3-7 -> 0.124.1-1)
    [2014-02-03 17:45] [PACMAN] upgraded jre7-openjdk-headless (7.u45_2.4.3-1 -> 7.u51_2.4.5-1)
    [2014-02-03 17:45] [PACMAN] upgraded jre7-openjdk (7.u45_2.4.3-1 -> 7.u51_2.4.5-1)
    [2014-02-03 17:45] [PACMAN] upgraded jdk7-openjdk (7.u45_2.4.3-1 -> 7.u51_2.4.5-1)
    [2014-02-03 17:45] [PACMAN] upgraded strigi (0.7.8-4 -> 0.7.8-5)
    [2014-02-03 17:46] [PACMAN] upgraded kdelibs (4.12.0-1 -> 4.12.1-1)
    [2014-02-03 17:46] [PACMAN] upgraded ldns (1.6.16-1 -> 1.6.17-1)
    [2014-02-03 17:46] [PACMAN] upgraded lib32-glibc (2.18-11 -> 2.18-12)
    [2014-02-03 17:46] [PACMAN] upgraded libdvdread (4.2.0-1 -> 4.2.1-1)
    [2014-02-03 17:46] [PACMAN] upgraded libdvdnav (4.2.0-2 -> 4.2.1-1)
    [2014-02-03 17:46] [PACMAN] upgraded libgnome-keyring (3.10.1-1 -> 3.10.1-2)
    [2014-02-03 17:46] [PACMAN] upgraded libgphoto2 (2.5.2-2 -> 2.5.3.1-1)
    [2014-02-03 17:46] [PACMAN] upgraded libmpc (1.0.1-2 -> 1.0.2-2)
    [2014-02-03 17:46] [PACMAN] upgraded libpcap (1.5.1-1 -> 1.5.3-1)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-en-US (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded rasqal (1:0.9.30-3 -> 1:0.9.30-4)
    [2014-02-03 17:46] [PACMAN] upgraded redland (1:1.0.16-2 -> 1:1.0.17-1)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-common (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-base (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-calc (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-draw (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-gnome (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-impress (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-kde4 (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-math (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-postgresql-connector (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-sdk (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-sdk-doc (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded libreoffice-writer (4.1.4-1 -> 4.1.4-3)
    [2014-02-03 17:46] [PACMAN] upgraded libvncserver (0.9.9-2 -> 0.9.9-3)
    [2014-02-03 17:46] [PACMAN] upgraded libwbclient (4.1.3-1 -> 4.1.4-1)
    [2014-02-03 17:46] [PACMAN] upgraded libxnvctrl (331.20-1 -> 331.38-2)
    [2014-02-03 17:47] [PACMAN] upgraded linux-firmware (20131013.7d0c7a8-1 -> 20140123.418320b-1)
    [2014-02-03 17:47] [ALPM-SCRIPTLET] >>> Updating module dependencies. Please wait ...
    [2014-02-03 17:47] [ALPM-SCRIPTLET] >>> Generating initial ramdisk, using mkinitcpio. Please wait...
    [2014-02-03 17:47] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
    [2014-02-03 17:47] [ALPM-SCRIPTLET] ==> Starting build: 3.12.9-2-ARCH
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [base]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [udev]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [autodetect]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [modconf]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [block]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [filesystems]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [keyboard]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [fsck]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] ==> Generating module dependencies
    [2014-02-03 17:47] [ALPM-SCRIPTLET] ==> Creating gzip initcpio image: /boot/initramfs-linux.img
    [2014-02-03 17:47] [ALPM-SCRIPTLET] ==> Image generation successful
    [2014-02-03 17:47] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
    [2014-02-03 17:47] [ALPM-SCRIPTLET] ==> Starting build: 3.12.9-2-ARCH
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [base]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [udev]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [modconf]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [block]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] ==> WARNING: Possibly missing firmware for module: aic94xx
    [2014-02-03 17:47] [ALPM-SCRIPTLET] ==> WARNING: Possibly missing firmware for module: smsmdtv
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [filesystems]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [keyboard]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] -> Running build hook: [fsck]
    [2014-02-03 17:47] [ALPM-SCRIPTLET] ==> Generating module dependencies
    [2014-02-03 17:47] [ALPM-SCRIPTLET] ==> Creating gzip initcpio image: /boot/initramfs-linux-fallback.img
    [2014-02-03 17:47] [ALPM-SCRIPTLET] ==> Image generation successful
    [2014-02-03 17:47] [PACMAN] upgraded linux (3.12.6-1 -> 3.12.9-2)
    [2014-02-03 17:47] [PACMAN] upgraded linux-headers (3.12.6-1 -> 3.12.9-2)
    [2014-02-03 17:47] [PACMAN] upgraded lirc-utils (1:0.9.0-67 -> 1:0.9.0-69)
    [2014-02-03 17:47] [PACMAN] upgraded lm_sensors (3.3.4-1 -> 3.3.5-1)
    [2014-02-03 17:47] [PACMAN] upgraded lvm2 (2.02.104-1 -> 2.02.105-1)
    [2014-02-03 17:47] [PACMAN] upgraded lxappearance (0.5.4-1 -> 0.5.5-1)
    [2014-02-03 17:47] [PACMAN] upgraded man-db (2.6.5-1 -> 2.6.6-1)
    [2014-02-03 17:47] [PACMAN] upgraded man-pages (3.55-1 -> 3.57-1)
    [2014-02-03 17:47] [PACMAN] upgraded mpg123 (1.17.0-1 -> 1.18.0-1)
    [2014-02-03 17:47] [PACMAN] upgraded smbclient (4.1.3-1 -> 4.1.4-1)
    [2014-02-03 17:47] [PACMAN] upgraded mplayer (36498-4 -> 36498-5)
    [2014-02-03 17:47] [PACMAN] upgraded ntp (4.2.6.p5-17 -> 4.2.6.p5-18)
    [2014-02-03 17:47] [PACMAN] upgraded nvidia (331.20-3 -> 331.38-2)
    [2014-02-03 17:47] [ALPM] warning: /etc/ssh/sshd_config installed as /etc/ssh/sshd_config.pacnew
    [2014-02-03 17:47] [PACMAN] upgraded openssh (6.4p1-1 -> 6.5p1-1)
    [2014-02-03 17:48] [PACMAN] upgraded opera (12.16.1860-1 -> 12.16.1860-2)
    [2014-02-03 17:48] [ALPM] warning: /etc/pacman.d/mirrorlist installed as /etc/pacman.d/mirrorlist.pacnew
    [2014-02-03 17:48] [PACMAN] upgraded pacman-mirrorlist (20130830-1 -> 20140107-1)
    [2014-02-03 17:48] [PACMAN] upgraded procps-ng (3.3.9-1 -> 3.3.9-2)
    [2014-02-03 17:48] [PACMAN] upgraded python2-mako (0.9.0-1 -> 0.9.1-1)
    [2014-02-03 17:48] [PACMAN] upgraded python2-pillow (2.2.2-1 -> 2.3.0-3)
    [2014-02-03 17:48] [PACMAN] upgraded python2-setuptools (2.0.2-1 -> 2.1-1)
    [2014-02-03 17:48] [PACMAN] upgraded redland-storage-virtuoso (1:1.0.16-2 -> 1:1.0.17-1)
    [2014-02-03 17:48] [PACMAN] upgraded s-nail (14.5.1-1 -> 14.5.2-2)
    [2014-02-03 17:48] [PACMAN] upgraded sudo (1.8.8-1 -> 1.8.9.p4-1)
    [2014-02-03 17:48] [PACMAN] upgraded syslog-ng (3.5.2-1 -> 3.5.3-1)
    [2014-02-03 17:48] [PACMAN] upgraded systemd-sysvcompat (208-3 -> 208-10)
    [2014-02-03 17:48] [ALPM-SCRIPTLET] In order to use the new version, reload all virtualbox modules manually.
    [2014-02-03 17:48] [PACMAN] upgraded virtualbox-host-modules (4.3.6-2 -> 4.3.6-4)
    [2014-02-03 17:48] [PACMAN] upgraded virtualbox (4.3.6-2 -> 4.3.6-3)
    [2014-02-03 17:48] [PACMAN] upgraded virtualbox-guest-modules (4.3.6-2 -> 4.3.6-4)
    [2014-02-03 17:48] [PACMAN] upgraded vlc (2.1.2-1 -> 2.1.2-3)
    [2014-02-03 17:48] [PACMAN] upgraded wget (1.14-3 -> 1.15-1)
    [2014-02-03 17:48] [PACMAN] upgraded xcb-util-wm (0.3.9-1 -> 0.4.0-1)
    [2014-02-03 17:48] [PACMAN] upgraded xextproto (7.2.1-1 -> 7.3.0-1)
    [2014-02-03 17:48] [PACMAN] upgraded xine-lib (1.2.4-1 -> 1.2.4-3)
    [2014-02-03 17:48] [PACMAN] upgraded xorg-server-xephyr (1.14.5-2 -> 1.15.0-5)
    Last edited by orjanp (2014-02-06 14:43:51)

    orjanp wrote:Thanks, not sure what a compositor is, so I don't know. I guess, then I dont run one.
    https://wiki.archlinux.org/index.php/Compton
    https://wiki.archlinux.org/index.php/Xcompmgr
    https://wiki.archlinux.org/index.php/Cairo_Compmgr

  • Class not found

    OS - Ubuntu Gutsy 7.10
    Kernel - 2.6.22-14-generic
    NB - v5.5.1
    Java version - java version "1.5.0" / gij (GNU libgcj) version 4.2.1 (Ubuntu 4.2.1-5ubuntu5)
    Hi people, I've been working on this problem for a few hours now and htink I'm missing the obvious:
    This is my source directory path:
    /home/buster/NB_Projects/Team_CB_UML_080407_v3.2_Final_mb/CB_UML_Editor/src/teamcbuml/helpDocs/index.htm
    I am trying to implement HTML help documentation to my UML editor in NetBeans:
    My Help class source is as follows:
    * Help - Provides user documentation
    * Created on 06 March 2008, 00:22
    package teamcbuml;
    import java.io.*;
    import java.net.URL;
    import javax.swing.event.HyperlinkEvent;
    * @author  M.Beattie
    public class Help extends javax.swing.JFrame {
        private URL helpURL;
        /** Creates new form Help */
        public Help(URL hlpURL) {
            helpURL = hlpURL;
            try {
                HelpDisplayArea.setPage(helpURL);
            catch (Exception ex) {
                ex.printStackTrace();
            initComponents();
            this.setLocationRelativeTo(null);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
        private void initComponents() {
            HelpScrollPane = new javax.swing.JScrollPane();
            HelpDisplayArea = new javax.swing.JEditorPane();
            companyLogo = new javax.swing.JLabel();
            HelpContentsButton = new javax.swing.JButton();
            HelpCloseButton = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            setTitle("UML Editor Help");
            HelpScrollPane.setBackground(new java.awt.Color(255, 255, 255));
            HelpScrollPane.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
            HelpDisplayArea.setEditable(false);
            HelpDisplayArea.addHyperlinkListener(new javax.swing.event.HyperlinkListener() {
                public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {
                    HelpDisplayAreaHyperlinkUpdate(evt);
            HelpScrollPane.setViewportView(HelpDisplayArea);
            companyLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/teamcbuml/images/logo.gif")));
            HelpContentsButton.setText("Contents");
            HelpContentsButton.setToolTipText("Return to contents page");
            HelpContentsButton.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    HelpContentsButtonMouseClicked(evt);
            HelpCloseButton.setText("Close");
            HelpCloseButton.setToolTipText("Close help documentation");
            HelpCloseButton.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    HelpCloseButtonMouseClicked(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(HelpScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
                            .addContainerGap())
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(companyLogo)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 198, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(HelpCloseButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(HelpContentsButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGap(83, 83, 83))))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(companyLogo))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addGap(20, 20, 20)
                            .addComponent(HelpContentsButton)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(HelpCloseButton)))
                    .addGap(14, 14, 14)
                    .addComponent(HelpScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 396, Short.MAX_VALUE)
                    .addContainerGap())
            pack();
        }// </editor-fold>//GEN-END:initComponents
        private void HelpContentsButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_HelpContentsButtonMouseClicked
            /** Select contents index */
            URL tempURL;
            tempURL = HelpDisplayArea.getPage();
            try{
                HelpDisplayArea.setPage(helpURL);
            catch (Exception ex) {
                ex.printStackTrace();
        }//GEN-LAST:event_HelpContentsButtonMouseClicked
        private void HelpDisplayAreaHyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_HelpDisplayAreaHyperlinkUpdate
            /** Select page to display */
            if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
            try{
                HelpDisplayArea.setPage(evt.getURL());
            catch (Exception ex) {
                ex.printStackTrace();
        }//GEN-LAST:event_HelpDisplayAreaHyperlinkUpdate
        private void HelpCloseButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_HelpCloseButtonMouseClicked
            /** Close Help Documentation */
            this.dispose();
        }//GEN-LAST:event_HelpCloseButtonMouseClicked
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    URL index = ClassLoader.getSystemResource("/helpDocs/index.htm");
                    new Help(index).setVisible(true);        
        // Variables declaration - do not modify//GEN-BEGIN:variables
        private javax.swing.JButton HelpCloseButton;
        private javax.swing.JButton HelpContentsButton;
        private javax.swing.JEditorPane HelpDisplayArea;
        private javax.swing.JScrollPane HelpScrollPane;
        private javax.swing.JLabel companyLogo;
        // End of variables declaration//GEN-END:variables
    }Everything compiles without error and the program runs, however when I click my button for the Help Interface, it displays everything except the index.htm info and throws a few errors. Mainly one error (NullPointerException) and I think the rest are subsequent errors. I figure it is something to do with the way I have defined the source path but am struggling to get anywhere with it. I have researched the net but finding something totally relevant to NetBeans I am struggling with.
    Any advice is much appreciated.
    Thanks

    Just to clarify, the following is the code that is flagged as erroneous:
    /** Creates new form Help */
        public Help(URL hlpURL) {
            helpURL = hlpURL;
            try {
                HelpDisplayArea.setPage(helpURL);
            catch (Exception ex) {
                ex.printStackTrace();
            initComponents();
            this.setLocationRelativeTo(null);
            }The line complained about is:
    HelpDisplayArea.setPage(helpURL);

  • Mutlithreading with GUI

    hey guys,
    I was working on some Socket programming assignment and encountered an intersting problem.
    i am using Swing for GUI and Threads to communicate with clients.
    My server GUi has a JButton("Start Server") to trigger the Server. or we can say.. it starts accepting connection( SocketObj = ServerSocketObj.accept() )
    problem:
    as soon as i press the only Button(i.e. StartServer Button) on my Server GUI. whole GUI freezes!
    but Server is working... all updates on GUI are missing.. cant repaint components, etc. neither WindowClosing event , setDefaultCloseOperation()) is working.
    i did some research.. found that swing components are not thread safe,
    also found some close answers,, along the lines of.. Event Dispatch Thread, SwingUtilities.invokeLater(Runnable), SwingWorker class , but neither work or maybe i did not implement them properly..
    Attachment contains my code for:
    Server.java : Server class conatins main()
    ServerGUI.java : gui for server.. called from Server Class
    ClientHandler.java : Thread for handling clients.. also called from Serve class
    Cleint.java : simple client to connect to server at localhost
    Any sort of help would be highly obliged.
    thanks in advance.
    - Ravi

    Server.java
    import java.net.*;
    import java.io.*;
    public class Server {
        private ServerSocket ss;
        private Socket sc;
        public ServerSocket getSs() {
            return ss;
        public void setSs(ServerSocket ss) {
            this.ss = ss;
        public Socket getSc() {
            return sc;
        public void setSc(Socket sc) {
            this.sc = sc;
        public Server() {
            try{
            ss = new ServerSocket(4000);
            }catch(IOException e){e.printStackTrace();}
            startGUI();
        public void startGUI()
            new ServerGUI(this);
        public void getConnection()
            int i = 1;
            try {
                Socket sc = getSc();
                while (true) {
                    sc = getSs().accept();
                    Thread t = new Thread(new ClientHandler(sc,i));
                    t.start();
                    System.out.println("got client " + i);
                    i++;
            } catch (IOException e) {
                e.printStackTrace();
        public static void main(String[] args) {
            new Server();
    }ServerGUI.java
    import java.net.*;
    import java.io.*;
    public class ServerGUI extends javax.swing.JFrame {
         private javax.swing.JButton jButton1;
        Server m;
        public ServerGUI(Server m) {
            initComponents();
            this.m=m;
            setVisible(true);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
        private void initComponents() {
            jButton1 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jButton1.setText("jButton1");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(178, Short.MAX_VALUE)
                    .addComponent(jButton1)
                    .addGap(147, 147, 147))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(93, 93, 93)
                    .addComponent(jButton1)
                    .addContainerGap(184, Short.MAX_VALUE))
            pack();
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
            m.getConnection();
    }ClientHandler.java
    import java.net.*;
    public class ClientHandler implements Runnable {
        Socket sock;
        int n;
        public ClientHandler(Socket s, int n) {
            sock = s;
            this.n = n;
        public void run() {
            while (true) {
                System.out.println("Client Thread: " + n);
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
    }Client.java
    import java.net.*;
    import java.io.*;
    public class Client {
        Socket sc;
        public Client() {
            try{
            sc=new Socket("127.0.0.1",4000);
            System.out.println("got server");
            }catch(UnknownHostException e){e.printStackTrace();}
            catch(IOException e){e.printStackTrace();}
        public static void main(String args[])
            new Client();
    }

  • Mutlithreading with GUI problem

    hey guys,
    I was working on some Socket programming assignment and encountered an intersting problem.
    i am using Swing for GUI and Threads to communicate with clients.
    My server GUi has a JButton("Start Server") to trigger the Server. or we can say.. it starts accepting connection( SocketObj = ServerSocketObj.accept() )
    problem:
    as soon as i press the only Button(i.e. StartServer Button) on my Server GUI. whole GUI freezes!
    but Server is working... all updates on GUI are missing.. cant repaint components, etc. neither WindowClosing event , setDefaultCloseOperation()) is working.
    i did some research.. found that swing components are not thread safe,
    also found some close answers,, along the lines of.. Event Dispatch Thread, SwingUtilities.invokeLater(Runnable), SwingWorker class , but neither work or maybe i did not implement them properly..
    Attachment contains my code for:
    Server.java : Server class conatins main()
    ServerGUI.java : gui for server.. called from Server Class
    ClientHandler.java : Thread for handling clients.. also called from Serve class
    Cleint.java : simple client to connect to server at localhost
    Any sort of help would be highly obliged.
    thanks in advance.
    - Ravi

    here is the code...
    Server.java
    import java.net.*;
    import java.io.*;
    public class Server {
        private ServerSocket ss;
        private Socket sc;
        public ServerSocket getSs() {
            return ss;
        public void setSs(ServerSocket ss) {
            this.ss = ss;
        public Socket getSc() {
            return sc;
        public void setSc(Socket sc) {
            this.sc = sc;
        public Server() {
            try{
            ss = new ServerSocket(4000);
            }catch(IOException e){e.printStackTrace();}
            startGUI();
        public void startGUI()
            new ServerGUI(this);
        public void getConnection()
            int i = 1;
            try {
                Socket sc = getSc();
                while (true) {
                    sc = getSs().accept();
                    Thread t = new Thread(new ClientHandler(sc,i));
                    t.start();
                    System.out.println("got client " + i);
                    i++;
            } catch (IOException e) {
                e.printStackTrace();
        public static void main(String[] args) {
            new Server();
    }ServerGUI.java
    import java.net.*;
    import java.io.*;
    public class ServerGUI extends javax.swing.JFrame {
         private javax.swing.JButton jButton1;
        Server m;
        public ServerGUI(Server m) {
            initComponents();
            this.m=m;
            setVisible(true);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
        private void initComponents() {
            jButton1 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jButton1.setText("jButton1");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(178, Short.MAX_VALUE)
                    .addComponent(jButton1)
                    .addGap(147, 147, 147))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(93, 93, 93)
                    .addComponent(jButton1)
                    .addContainerGap(184, Short.MAX_VALUE))
            pack();
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
            m.getConnection();
    }ClientHandler.java
    import java.net.*;
    public class ClientHandler implements Runnable {
        Socket sock;
        int n;
        public ClientHandler(Socket s, int n) {
            sock = s;
            this.n = n;
        public void run() {
            while (true) {
                System.out.println("Client Thread: " + n);
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
    }Client.java
    import java.net.*;
    import java.io.*;
    public class Client {
        Socket sc;
        public Client() {
            try{
            sc=new Socket("127.0.0.1",4000);
            System.out.println("got server");
            }catch(UnknownHostException e){e.printStackTrace();}
            catch(IOException e){e.printStackTrace();}
        public static void main(String args[])
            new Client();
    }

  • How do i use objects from one class in anohter?

    Hey
    I have two GUI classes ShowWhiteGUI and BasketGUI and then a control class ShowWhite. The control class calls all the method from anohter class's which the GUI classes are gonna use.
    The basis idea with this script is it shall be a very very simpel Shop. Where you can add items to a basket and then show the items in a new window(BasketGUI).
    So here is the problem. I cant create an object in both GUI classes, because then im working with two sets of data, right? So how do i do this?
    Here is my code:
    ShowWhiteGUI
    * ShowWhiteGUI.java
    * Created on 5. februar 2008, 10:43
    package userclasses;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    * @author  Lille mus
    public class ShowWhiteGUI extends javax.swing.JFrame {
        private BasketGUI basketGUI;
        private ShowWhite control;
        /** Creates new form ShowWhiteGUI */
        public ShowWhiteGUI() {
            basketGUI = new BasketGUI();
            control = new ShowWhite();
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
        private void initComponents() {
            aboutDialog = new javax.swing.JDialog();
            jLabel1 = new javax.swing.JLabel();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            itemIdField = new javax.swing.JTextField();
            productIdLabel = new javax.swing.JLabel();
            numberOfItems = new javax.swing.JLabel();
            productId = new javax.swing.JTextField();
            basketButton = new javax.swing.JButton();
            jLabel2 = new javax.swing.JLabel();
            showBasketButton = new javax.swing.JButton();
            jMenuBar1 = new javax.swing.JMenuBar();
            menu = new javax.swing.JMenu();
            jMenu1 = new javax.swing.JMenu();
            open = new javax.swing.JMenuItem();
            quit = new javax.swing.JMenuItem();
            jMenuItem1 = new javax.swing.JMenuItem();
            jMenu2 = new javax.swing.JMenu();
            help = new javax.swing.JMenuItem();
            about = new javax.swing.JMenuItem();
            javax.swing.GroupLayout aboutDialogLayout = new javax.swing.GroupLayout(aboutDialog.getContentPane());
            aboutDialog.getContentPane().setLayout(aboutDialogLayout);
            aboutDialogLayout.setHorizontalGroup(
                aboutDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 400, Short.MAX_VALUE)
            aboutDialogLayout.setVerticalGroup(
                aboutDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 300, Short.MAX_VALUE)
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Show White's Shop");
            setBackground(new java.awt.Color(0, 102, 255));
            jLabel1.setFont(new java.awt.Font("Baby Kruffy", 0, 36));
            jLabel1.setText("Snow White?s Shop");
            jTextArea1.setColumns(20);
            jTextArea1.setEditable(false);
            jTextArea1.setRows(5);
            jTextArea1.setText(control.getPrintAllStockItems());
            jScrollPane1.setViewportView(jTextArea1);
            productIdLabel.setText("Varenummer:");
            numberOfItems.setText("Antal:");
            basketButton.setText("L?g i kurv");
            basketButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    putInBasket(evt);
            showBasketButton.setText("Vis indk?bskurv");
            showBasketButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    showBasket(evt);
            menu.setLabel("Fil");
            jMenu1.setText("Menu");
            menu.add(jMenu1);
            open.setLabel("?bn");
            open.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    open(evt);
            menu.add(open);
            quit.setLabel("Luk");
            quit.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    quit(evt);
            menu.add(quit);
            jMenuItem1.setLabel("Gem");
            jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    save(evt);
            menu.add(jMenuItem1);
            jMenuBar1.add(menu);
            jMenu2.setLabel("Hj?lp");
            help.setLabel("Hj?lp");
            help.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    help(evt);
            jMenu2.add(help);
            about.setLabel("Om Show White Shop");
            jMenu2.add(about);
            jMenuBar1.add(jMenu2);
            setJMenuBar(jMenuBar1);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(37, 37, 37)
                            .addComponent(jLabel1))
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                    .addComponent(productIdLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(itemIdField, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(numberOfItems))
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(productId, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 65, Short.MAX_VALUE)
                                        .addComponent(basketButton))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(31, 31, 31)
                                        .addComponent(jLabel2)))
                                .addGroup(layout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(showBasketButton)))))
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jLabel1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel2))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(productIdLabel)
                                .addComponent(itemIdField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(numberOfItems)
                                .addComponent(productId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(showBasketButton)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 202, Short.MAX_VALUE)
                            .addComponent(basketButton)))
                    .addContainerGap())
            pack();
        }// </editor-fold>                       
        public void createBasketWindow(){
            basketGUI.setVisible(true);
        private void showBasket(java.awt.event.ActionEvent evt) {                           
            createBasketWindow();
        private void putInBasket(java.awt.event.ActionEvent evt) {                            
            Integer itemId = Integer.parseInt(itemIdField.getText());
            String petToAdd = control.getFindItem(itemId);
            System.out.println(petToAdd);
            control.setAddItemToBasket(itemId);
            basketGUI.addPetToBasket(petToAdd);     
        private void help(java.awt.event.ActionEvent evt) {                     
        private void save(java.awt.event.ActionEvent evt) {                     
            System.out.println("Gemmer fil");
        private void open(java.awt.event.ActionEvent evt) {                     
            System.out.println("?bn fil");
        private void quit(java.awt.event.ActionEvent evt) {                     
            System.exit(0);
        public ShowWhite getControl(){
            return control;
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new ShowWhiteGUI().setVisible(true);
        // Variables declaration - do not modify                    
        private javax.swing.JMenuItem about;
        private javax.swing.JDialog aboutDialog;
        private javax.swing.JButton basketButton;
        private javax.swing.JMenuItem help;
        private javax.swing.JTextField itemIdField;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JMenu jMenu1;
        private javax.swing.JMenu jMenu2;
        private javax.swing.JMenuBar jMenuBar1;
        private javax.swing.JMenuItem jMenuItem1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTextArea jTextArea1;
        private javax.swing.JMenu menu;
        private javax.swing.JLabel numberOfItems;
        private javax.swing.JMenuItem open;
        private javax.swing.JTextField productId;
        private javax.swing.JLabel productIdLabel;
        private javax.swing.JMenuItem quit;
        private javax.swing.JButton showBasketButton;
        // End of variables declaration                  
    }BasketGUI:
    * Basket.java
    * Created on 5. februar 2008, 15:29
    package userclasses;
    import javax.swing.JTextArea;
    * @author  Lille mus
    public class BasketGUI extends javax.swing.JFrame {
        private String newline = "\n";
        private InvoiceGUI invoiceGUI;
        /** Creates new form Basket */
        public BasketGUI() {       
            initComponents();
            //invoiceGUI = new InvoiceGUI();
        public void addPetToBasket(String pet){
            jTextArea1.append(pet+newline);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
        private void initComponents() {
            jLabel1 = new javax.swing.JLabel();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            jButton1 = new javax.swing.JButton();
            itemIdField = new javax.swing.JTextField();
            jLabel2 = new javax.swing.JLabel();
            removeItemButton = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Indk?bskurv");
            jLabel1.setText("Indk?bskurv");
            jTextArea1.setColumns(20);
            jTextArea1.setRows(5);
            jScrollPane1.setViewportView(jTextArea1);
            jButton1.setText("K?b og print kvittering");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    printInvoice(evt);
            jLabel2.setText("Slet varenr");
            removeItemButton.setText("Slet");
            removeItemButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    removeItemFromBasket(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(21, 21, 21)
                            .addComponent(jLabel1))
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 141, Short.MAX_VALUE)
                                    .addComponent(jButton1))
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jLabel2)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(itemIdField, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(removeItemButton)))))
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel1)
                    .addGap(20, 20, 20)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jButton1)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 125, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel2)
                        .addComponent(itemIdField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(removeItemButton))
                    .addContainerGap())
            pack();
        }// </editor-fold>                       
        private void removeItemFromBasket(java.awt.event.ActionEvent evt) {                                     
            Integer itemId = Integer.parseInt(itemIdField.getText());
        private void printInvoice(java.awt.event.ActionEvent evt) {                             
            //invoiceGUI.setVisible(true);
        public JTextArea getTextArea(){
            return jTextArea1;
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new BasketGUI().setVisible(true);
        // Variables declaration - do not modify                    
        private javax.swing.JTextField itemIdField;
        private javax.swing.JButton jButton1;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTextArea jTextArea1;
        private javax.swing.JButton removeItemButton;
        // End of variables declaration                  
    }ShowWhite:
    * ShowWhite.java
    * Created on 13. februar 2008, 18:15
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package userclasses;
    * @author Lille mus
    public class ShowWhite {
        public Basket basket;
        public Stock stock;
        /** Creates a new instance of ShowWhite */
        public ShowWhite() {
            stock = new Stock();
            basket = new Basket();
        public String getFindItem(int itemId){
            String returnItem = stock.findItem(itemId);
            return returnItem;
        public void setAddItemToBasket(int itemId){
            basket.addItemToBasket(itemId);
        public String getPrintAllStockItems(){
            return stock.printAllStockItems();
        public String getShowBasket(){
             return basket.showBasket();
        public void setRemoveItemFromBasket(int itemId){
            basket.removeItemFromBasket(itemId);
    }

    okay i tried this, but it give me a nullpointerexeption:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at userclasses.ShowWhiteGUI.initComponents(ShowWhiteGUI.java:75)
    at userclasses.ShowWhiteGUI.<init>(ShowWhiteGUI.java:21)
    at userclasses.ShowWhite.<init>(ShowWhite.java:26)
    at userclasses.Main.<init>(Main.java:16)
    at userclasses.Main$1.run(Main.java:31)
    ShowWhite
    public class ShowWhite {
        public Basket basket;
        public Stock stock;
        private ShowWhiteGUI mainGUI;
        private BasketGUI basketGUI;
        /** Creates a new instance of ShowWhite */
        public ShowWhite() {
            stock = new Stock();
            basket = new Basket();
            mainGUI = new ShowWhiteGUI(this);
            basketGUI = new BasketGUI();
        public String getFindItem(int itemId){
            String returnItem = stock.findItem(itemId);
            return returnItem;
        public void setAddItemToBasket(int itemId){
            basket.addItemToBasket(itemId);
        public String getPrintAllStockItems(){
            return stock.printAllStockItems();
        public String getShowBasket(){
             return basket.showBasket();
        public void setRemoveItemFromBasket(int itemId){
            basket.removeItemFromBasket(itemId);
        public void createMainGUI(){
            mainGUI.setVisible(true);
        public BasketGUI getBasketGUI(){
            return basketGUI;
        public void setAddPetToBasket(String pet){
            basketGUI.addPetToBasket(pet);
    }ShowWhiteGUI:
    public class ShowWhiteGUI extends javax.swing.JFrame {
        private ShowWhite control;
        /** Creates new form ShowWhiteGUI */
        public ShowWhiteGUI(ShowWhite control) {
            initComponents();
            this.control = control;
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
        private void initComponents() {
            aboutDialog = new javax.swing.JDialog();
            jLabel1 = new javax.swing.JLabel();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            itemIdField = new javax.swing.JTextField();
            productIdLabel = new javax.swing.JLabel();
            numberOfItems = new javax.swing.JLabel();
            productId = new javax.swing.JTextField();
            basketButton = new javax.swing.JButton();
            jLabel2 = new javax.swing.JLabel();
            showBasketButton = new javax.swing.JButton();
            jMenuBar1 = new javax.swing.JMenuBar();
            menu = new javax.swing.JMenu();
            jMenu1 = new javax.swing.JMenu();
            open = new javax.swing.JMenuItem();
            quit = new javax.swing.JMenuItem();
            jMenuItem1 = new javax.swing.JMenuItem();
            jMenu2 = new javax.swing.JMenu();
            help = new javax.swing.JMenuItem();
            about = new javax.swing.JMenuItem();
            javax.swing.GroupLayout aboutDialogLayout = new javax.swing.GroupLayout(aboutDialog.getContentPane());
            aboutDialog.getContentPane().setLayout(aboutDialogLayout);
            aboutDialogLayout.setHorizontalGroup(
                aboutDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 400, Short.MAX_VALUE)
            aboutDialogLayout.setVerticalGroup(
                aboutDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 300, Short.MAX_VALUE)
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Show White's Shop");
            setBackground(new java.awt.Color(0, 102, 255));
            jLabel1.setFont(new java.awt.Font("Baby Kruffy", 0, 36));
            jLabel1.setText("Snow White?s Shop");
            jTextArea1.setColumns(20);
            jTextArea1.setEditable(false);
            jTextArea1.setRows(5);
            jTextArea1.setText(control.getPrintAllStockItems());
            jScrollPane1.setViewportView(jTextArea1);
            productIdLabel.setText("Varenummer:");
            numberOfItems.setText("Antal:");
            basketButton.setText("L?g i kurv");
            basketButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    putInBasket(evt);
            showBasketButton.setText("Vis indk?bskurv");
            showBasketButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    showBasket(evt);
            menu.setLabel("Fil");
            jMenu1.setText("Menu");
            menu.add(jMenu1);
            open.setLabel("?bn");
            open.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    open(evt);
            menu.add(open);
            quit.setLabel("Luk");
            quit.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    quit(evt);
            menu.add(quit);
            jMenuItem1.setLabel("Gem");
            jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    save(evt);
            menu.add(jMenuItem1);
            jMenuBar1.add(menu);
            jMenu2.setLabel("Hj?lp");
            help.setLabel("Hj?lp");
            help.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    help(evt);
            jMenu2.add(help);
            about.setLabel("Om Show White Shop");
            jMenu2.add(about);
            jMenuBar1.add(jMenu2);
            setJMenuBar(jMenuBar1);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(37, 37, 37)
                            .addComponent(jLabel1))
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                    .addComponent(productIdLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(itemIdField, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(numberOfItems))
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(productId, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 65, Short.MAX_VALUE)
                                        .addComponent(basketButton))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(31, 31, 31)
                                        .addComponent(jLabel2)))
                                .addGroup(layout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(showBasketButton)))))
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jLabel1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel2))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(productIdLabel)
                                .addComponent(itemIdField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(numberOfItems)
                                .addComponent(productId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(showBasketButton)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 202, Short.MAX_VALUE)
                            .addComponent(basketButton)))
                    .addContainerGap())
            pack();
        }// </editor-fold>                       
        public void createBasketWindow(){
            control.getBasketGUI().setVisible(true);
        private void showBasket(java.awt.event.ActionEvent evt) {                           
            createBasketWindow();
        private void putInBasket(java.awt.event.ActionEvent evt) {                            
            Integer itemId = Integer.parseInt(itemIdField.getText());
            String petToAdd = control.getFindItem(itemId);
            System.out.println(petToAdd);
            control.setAddItemToBasket(itemId);
            control.setAddPetToBasket(petToAdd);     
        private void help(java.awt.event.ActionEvent evt) {                     
        private void save(java.awt.event.ActionEvent evt) {                     
            System.out.println("Gemmer fil");
        private void open(java.awt.event.ActionEvent evt) {                     
            System.out.println("?bn fil");
        private void quit(java.awt.event.ActionEvent evt) {                     
            System.exit(0);
        public ShowWhite getControl(){
            return control;
        // Variables declaration - do not modify                    
        private javax.swing.JMenuItem about;
        private javax.swing.JDialog aboutDialog;
        private javax.swing.JButton basketButton;
        private javax.swing.JMenuItem help;
        private javax.swing.JTextField itemIdField;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JMenu jMenu1;
        private javax.swing.JMenu jMenu2;
        private javax.swing.JMenuBar jMenuBar1;
        private javax.swing.JMenuItem jMenuItem1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTextArea jTextArea1;
        private javax.swing.JMenu menu;
        private javax.swing.JLabel numberOfItems;
        private javax.swing.JMenuItem open;
        private javax.swing.JTextField productId;
        private javax.swing.JLabel productIdLabel;
        private javax.swing.JMenuItem quit;
        private javax.swing.JButton showBasketButton;
        // End of variables declaration                  
    }

Maybe you are looking for

  • Wrong folder and files order when attaching image ...

    Hello everyone! Long ago I noticed a bug in PC Suite: when you attach images to MMS message in PC Suite you would get a mixture of files and folder (folder, files, then again folders, again files, and - more surprising - also files from parent direct

  • MacBook freezes whenever I let it alone a few minutes

    This is happening to both of our MacBooks. Whenever we leave the computer for a few minutes, and then come back, the display is frozen, and the keyboard and trackpad are unresponsive. The cursor is stuck, doesn't move. If I hook up the mouse, the cur

  • Okay, is there anyway that i can make itunes compatible w/ 2003??

    I have windows 2003 and apparently, iTunes isn't compatible w/ it for some reason...but it doesn't tell me that, it just tells me it encountered a problem and had to close...i used my friends installation disc, even though she has the 30gb video ipod

  • Can't update my Iphone 4

    I've been trying like for the tenth time to update my Iphone IOS and I just can't. It takes some time for Itunes to download the available IOS and when it's almost downloaded, an error occurs, saying that the time for downloading is over. How come? I

  • How to set classpath for third party jdbc-driver

    my application contains bc4j jsp. when i try to run this jsp application which connect to postgresql, i get a error message "Application Error Return Error Message: JBO-30003: The application pool (App_ModLocal) failed to checkout an application modu