Monday, October 22, 2012

006. CONTAINER: JSPLITPANE BY NETBEANS


You can use JSplitpane to put two components, either left by right, or top by bottom. The user can resize a component by moving the divider. As usually, we asume that we have read and understood 001. THE BEGINNING.
  1. Create a JFrame then named Splitpane.
  2. Put JSplitpane from Palette
  3. Set properties, orientation=VERTICAL_SPLIT, dividerLocation=150
     
  4. Put another JSplitpane from Palette on top component.
  5. On Inspector, right-click jSplitPane2 (new JSplitpane) then renamed "splTop".
  6. Put another JSplitpane from Palette on bottom component.
  7. On Inspector, right-click the new JSplitpane then renamed "splBottom".
  8. On Inspector, click splTop, change property dividerLocation=150


  9. Run program

HOLDING THE BOTTOM-SIZE WHEN RESIZING THE JFRAME
  1. On Inspector, click the jSplitpane1 that we want to hold the bottom-size

  2. Setting the property, resizeWeight=1.0
  3. On Inspector, click splBottom
  4. Setting the properties,  maximumSize=0, minimumSize=0, and preferredSize=0

HOLDING THE RIGHT-SIZE WHEN RESIZING THE JFRAME
  1. From Palette click JPanel and put in on the right of splTop.
  2. On Inspector, click splTop, then set property, resizeWeight=1.0
     

  3. On Inspector, click jPanel1
  4. Setting the jPanel1's properties,  maximumSize=0, minimumSize=0, and preferredSize=0
  5. Just for tag, from Palette click JTabbedPane, and put it on the right of splBottom.
  6. From Palette, click JPanel and put it on JTabbedPane.
  7. From Palette, click JButton and put it on the new JPanel.
Please, run it.

Friday, June 8, 2012

MISC: SMARTFREN HAIER CE682 MODEM SETTING IN UBUNTU


I 've read many blogs for a week, to find a way so my Ubuntu would be able detecting my friend's modem (Haier CE682 from Smartfren - Indonesia). It (still) didn't work for me. Until I 've tried this way (on my netbook and my friend's PC, with Ubuntu 10.04, 11.04 and 12.04) :
  • Assume, we have downloaded wvdial.
  • From Terminal (console) type : lsusb
    find the location of your modem (example: 201e:1022)
  • From Terminal (console) type: sudo gedit /etc/modules
  • Add this script to that file:
    usbserial vendor=0x201e product=0x1022
  • Save and close that file.

  • type : sudo gedit /etc/usb_modeswitch.conf
  • Add this script:
    DefaultVendor = 0x201e
    DefaultProduct = 0×1022
    TargetVendor = 0x201e
    TargetProduct = 0×1022
    MessageContent=”5553424312345678c00000008000069f030000000000000000000000000000″

  • Save and close that file.

  • type : sudo gedit /etc/udev/rules.d/99-haier-ce682.rules
  • Add this script:
    SUBSYSTEM==”usb”, SYSFS{idVendor}==”201e”,
    SYSFS{idProduct}==”1022″, RUN+=”/usr/sbin/usb_modeswitch --default-vendor 0x201e --default-product 0×1022 --message-content 5553424312345678c00000008000069f030000000000000000000000000000″
  • Save and close that file.

  • type : sudo gedit /etc/wvdial.conf
  • Add this script:
    [Dialer smart]
    Init1 = ATZ
    Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    Stupid Mode = 1
    Modem Type = Analog Modem
    Command Line = ATDT
    ISDN = 0
    New PPPD = yes
    Phone = #777
    Modem = /dev/ttyUSB0
    Username = smart
    Password = smart
    Baud = 460800
  • Save and close that file.
  • May be we have to change a ttyUSB0 to another (ttyUSB1, etc), if needed. To find a modem location try : sudo /etc/wvdialconf

  • Plug a modem
    the modem lamp will on, but not blinking. We should plug a modem before a computer being on.
  • Shutdown Ubuntu, and restart.

  • type : sudo eject /dev/sr1 (if doesn't have CD-ROM type sudo eject /dev/sr0)
    The modem lamp will blinking slowly. It had not been detected as modem yet.
  • Restart computer (do not shutdown) and do not unplug the modem.

  • The modem lamp will blinking fast, it should be a modem mode.
  • From Terminal (console) type : sudo wvdial smart
  • Open the browser, I hope it work.