#AsuultSambar :

ASUULT.NET - ШИНЭ ЖИЛИЙН БАЯРЫН МЭНД ХҮРГЭЕ! 2017-2018
It is currently Jan.20.18 10:15 pm

All times are UTC+09:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: May.07.15 9:50 pm 
Offline
Шинэков Гишvvн
Шинэков Гишvvн

Joined: May.07.15 9:48 pm
Posts: 1
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.text.*;

public class Test1 extends JFrame
{
//Comboo box oruulah gej bgaa test
private JComboBox Ajiltantushaal;
private JLabel combo;

private String names[] =
{ "Менежер ", "Тогооч", "Үйлчлэгч", "Бусад ажилчин" };
private Icon icons[] = { new ImageIcon( names[ 0 ] ),
new ImageIcon( names[ 1 ] ), new ImageIcon( names[ 2 ] ),
new ImageIcon( names[ 3 ] ) };


private JLabel tsaglabel;
private JTextField ajilsantsagtext;


private JLabel ajilsantsaglabel;
private JTextField ajilsantsagtext1;


private JLabel niittsalinlabel;
private JTextField niittsalintext;


private JButton bodohtovch;
private JButton arilgah;


public Test1()
{
createUserInterface();
}

{

//Combobox

Container container = getContentPane();
container.setLayout( new FlowLayout() );


Ajiltantushaal = new JComboBox( names );
Ajiltantushaal.setMaximumRowCount( 3 );

Ajiltantushaal.addItemListener(

new ItemListener() {


public void itemStateChanged( ItemEvent event )
{

if ( event.getStateChange() == ItemEvent.SELECTED )
combo.setIcon( icons[
Ajiltantushaal.getSelectedIndex() ] );
}

}

);

container.add( Ajiltantushaal );


combo = new JLabel( icons[ 0 ] );
container.add( combo );

setSize( 350, 100 );
setVisible( true );
}

//duusch bna
public void createUserInterface()
{

Container contentPane = getContentPane();


contentPane.setLayout( null );
Ajiltantushaal.setBounds( 290, 10, 150, 100 );

contentPane.add( Ajiltantushaal );


tsaglabel = new JLabel();
tsaglabel.setBounds( 16, 16, 90, 21 );
tsaglabel.setText( "Цагийн хөлс:" );
contentPane.add( tsaglabel );


ajilsantsagtext = new JTextField();
ajilsantsagtext.setBounds( 165, 16, 90, 21 );
ajilsantsagtext.setHorizontalAlignment(
JTextField.RIGHT );
contentPane.add( ajilsantsagtext);


ajilsantsaglabel = new JLabel();
ajilsantsaglabel.setBounds( 16, 56, 150, 21 );
ajilsantsaglabel.setText( "Хэдэн цаг ажилласан бэ" );
contentPane.add( ajilsantsaglabel );


ajilsantsagtext1 = new JTextField();
ajilsantsagtext1.setBounds( 165, 56, 90, 21 );
ajilsantsagtext1.setHorizontalAlignment(
JTextField.RIGHT );
contentPane.add( ajilsantsagtext1 );


niittsalinlabel = new JLabel();
niittsalinlabel.setBounds( 16, 96, 150, 21 );
niittsalinlabel.setText( "Таны нийт цалин:" );
contentPane.add( niittsalinlabel );


niittsalintext = new JTextField();
niittsalintext.setBounds( 165, 96, 90, 21 );
niittsalintext.setHorizontalAlignment(
JTextField.RIGHT );
niittsalintext.setEditable( false );
contentPane.add( niittsalintext );


bodohtovch = new JButton();
bodohtovch.setBounds( 120, 136, 90, 24 );
bodohtovch.setText( "Бодох" );
contentPane.add( bodohtovch );
bodohtovch.addActionListener(

new ActionListener()
{

public void actionPerformed ( ActionEvent event )
{
calculateJButtonActionPerformed( event );
}

}

);
arilgah = new JButton();
arilgah.setBounds( 200, 136, 90, 24 );
arilgah.setText( "Арилгах" );
contentPane.add( arilgah );
arilgah.addActionListener(

new ActionListener()
{

public void actionPerformed ( ActionEvent event )
{
clearActionPerformed( event );
}

}

);


setTitle( "Цалин бодох" );
setSize( 230, 200 );
setVisible( true );

}
private void clearActionPerformed(java.awt.event.ActionEvent evt) {
ajilsantsagtext.setText("");
ajilsantsagtext1.setText("");
niittsalintext.setText("");

}

private void calculateJButtonActionPerformed( ActionEvent event )
{

double tsagiintsalin =
Double.parseDouble( ajilsantsagtext.getText() );


double ajiltsantsag =
Double.parseDouble( ajilsantsagtext1.getText() );


double niittsalin = calculatePay( ajiltsantsag, tsagiintsalin );


DecimalFormat dollars = new DecimalFormat( "0.0 төгрөг" );


niittsalintext.setText( dollars.format( niittsalin ) );

}


private double calculatePay( double tsag, double tsalin )
{

double niit;



final double HOUR_LIMIT = 40.0;


if ( tsag <= HOUR_LIMIT )
{

niit = tsag * tsag;
}
else
{

niit = ( tsalin * HOUR_LIMIT ) + ( tsag - HOUR_LIMIT ) *
( 1.5 * tsalin );
}

return niit;

}


public static void main( String[] args )
{
Test1 application = new Test1();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
application.setDefaultCloseOperation(
JFrame.EXIT_ON_CLOSE );
}

}




Ene deer Execption hiih gsen ym tgd oor asuuh ym bna


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC+09:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Copyright Asuult.NET © 2000-2015.
Administrative Contact: Khundaga Khurelbaatar [hundaga@hotmail.com]
Tel: 1-888-303-4927, Fax: 1-888-406-2264.
Powered by phpBB © 2000-2015 phpBB Group. Powered by phpBB® Forum Software © phpBB Limited