unit Unit3;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  Menus, StdCtrls;

type

  { TForm3 }

  TForm3 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Edit1: TEdit;
    GroupBox1: TGroupBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    RadioButton5: TRadioButton;
    RadioButton6: TRadioButton;
    RadioGroup1: TRadioGroup;
    SelDirDialog1: TSelectDirectoryDialog;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);

  private

  public

  end;

var
  Form3: TForm3;
  list: TStringList;
implementation
   Uses unit1;
{$R *.lfm}

{ TForm3 }



procedure TForm3.Button1Click(Sender: TObject);
begin
  close()
end;

procedure TForm3.Button2Click(Sender: TObject);
begin
   list := TStringList.Create;
   list.Clear;
   list.Add('');
   if RadioButton4.Checked then
    begin
     Form1.jdk_str:='';
     Form1.DirJDK := '';
    end;
   if RadioButton5.Checked then
    begin
     Form1.jdk_str:='runtime';
     Form1.DirJDK := ExtractFileDir(pr_path) + st_p + 'runtime';
     RadioButton5.Caption:='Встроенная(' + Form1.DirJDK + ')';
    end;
   if RadioButton6.Checked then
    begin
     Form1.jdk_str:=Edit1.Text;
     Form1.DirJDK := Form1.jdk_str;
    end;
   list.Strings[0]:=Form1.jdk_str;
   list.SaveToFile(Dirpro + st_p + 'jdk.ini');
   list.Destroy;
   close;
end;

procedure TForm3.Button3Click(Sender: TObject);
begin
  if SelDirDialog1.Execute then
   begin
    Edit1.Text:=SelDirDialog1.FileName;
    RadioButton6.Checked:=true;
   end
  else Edit1.Text:='';
end;

procedure TForm3.FormActivate(Sender: TObject);
begin
  if Form1.jdk_str = '' then
  begin
    RadioButton4.Checked:=true;
  end
  else
   if Form1.jdk_str = 'runtime' then
    begin
     RadioButton5.Checked:=true;
     RadioButton5.Caption:='Встроенная(' + Form1.DirJDK + ')';
    end
  else
  begin
     RadioButton6.Checked:=true;
     Edit1.Text:=Form1.DirJDK;
  end;
end;





end.

